LumpClose: Difference between revisions

From Zandronum Wiki
(Add example)
Tag: Source edit
 
Line 42: Line 42:
*[[LumpReadString]]
*[[LumpReadString]]
*[[LumpGetInfo]]
*[[LumpGetInfo]]
[[Category: ACS functions]]

Latest revision as of 15:58, 25 January 2024

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.
This article documents an ACS function which is only available in development builds of Zandronum 3.2 and newer.

void LumpClose(int lump) (development version 3.2-alpha and above only)

Usage

Closes the specified lump which has been opened with LumpOpen.

This function frees the internal handler that was created with LumpOpen and should always be called when finished with the lump to avoid issues.

Parameters

  • lump: The lump index as returned from LumpOpen.

Examples

// This script prints the lump index of all the `MAPINFO` lumps that can be found.
// `CLIENTSIDE` is optional.
Script 1 OPEN CLIENTSIDE
{
	int startIndex = -1;
	Log(s:"Collecting MAPINFO lumps.");
	
	while(true)
	{
		startIndex = LumpOpen("MAPINFO", startIndex + 1);
		if (startIndex == -1)
		{
			Log(s:"No more MAPINFO lumps found.");
			break;
		}
		
		Log(s:"Next MAPINFO lump was found at index ", d:startIndex, s:".");

		// At this point you can read its contents with either `LumpRead` or `LumpReadString`.

		// Make sure to close the lump again to free the handle.
		LumpClose(startIndex);
	}
}

See also