LumpClose: Difference between revisions
(Created page with "{{ACSWarning}}{{DevfeatureWarning|version=3.2|type=an ACS function}} void '''LumpClose'''(int ''lump'') {{Devfeature|3.2|alpha}} ==Usage== Closes the specified lump which has been opened with <code>LumpOpen</code>. This function frees the internal handler that was created with <code>LumpOpen</code> and should always be called when finished with the lump to avoid issues. ===Parameters=== *''lump'': The lump index as returned from <code>LumpOpen</code>. ==...") Tag: Source edit |
(Add example) |
||
Line 2: | Line 2: | ||
void '''LumpClose'''(int ''lump'') {{Devfeature|3.2|alpha}} | void '''LumpClose'''(int ''lump'') {{Devfeature|3.2|alpha}} | ||
==Usage== | ==Usage== | ||
Closes the specified lump which has been opened with | 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== | ==Examples== | ||
{{ | <syntaxhighlight lang="js" line="1"> | ||
// 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); | |||
} | |||
} | |||
</syntaxhighlight> | |||
==See also== | |||
*[[LumpOpen]] | |||
*[[LumpRead]] | |||
*[[LumpReadArray]] | |||
*[[LumpReadString]] | |||
*[[LumpGetInfo]] |
Revision as of 09:03, 4 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);
}
}