LumpClose

Revision as of 09:03, 4 January 2024 by FusedQyou (talk | contribs) (Add example)
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