LumpOpen: Difference between revisions
(Add example) |
m (Remove duplicate reference) Tag: Source edit |
||
Line 49: | Line 49: | ||
*[[LumpReadString]] | *[[LumpReadString]] | ||
*[[LumpGetInfo]] | *[[LumpGetInfo]] | ||
*[[LumpClose]] | *[[LumpClose]] | ||
[[Category:ACS functions]] | [[Category:ACS functions]] |
Revision as of 08:42, 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. |
int LumpOpen (str name[, int start, int flags]) (development version 3.2-alpha and above only)
Usage
Returns the index of the given lump, starting the search after start.
Parameters
- name: The name of the lump to find.
- start: The lump index to start searching for this lump after.
- flags: Can be a combination of the following values:
LUMP_OPEN_FULLPATH
: When specified, name represents the full path of the lump. For example,sounds/mysound.ogg
.
Return value
Returns the index of the lump, or -1 if the lump was not found.
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);
}
}