FindLump
Jump to navigation
Jump to search
native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace)
Usage
Finds a lump in the currently loaded archives and returns its index. The index can then be passed to ReadLump to read the contents of the lump.
If a lump with the given name isn't found, returns -1;
Parameters
- String name
- The name of the lump to find as a string.
- Note, this can be used to find any arbitrary lump name; it doesn't have to be one of the default lumps.
- int startlump
- The index at which to begin the search. Since multiple lumps with the same name can be loaded at once, each of them will have an index, and that index will need to be incremented if there's a need to find all of them.
- FindLumpNamespace ns
- The namespace to search for. (Need more info) Possible values:
- Wads.GlobalNamespace
- Wads.AnyNamespace
Return values
- int — returns the index of the lump that can then be passed to ReadLump. If the given lump is not found, returns
-1
.
Examples
This example shows how to find all currently loaded TEXTURES lumps and push their contents into a dynamic array:
array<String> allTexturesContents;
// Find a lump named TEXTURES:
int lump = Wads.FindLump("TEXTURES", 0);
// Keep searching until there are no more
// lumps with this name to be found:
while (lump != -1)
{
String lumpContents = Wads.ReadLump(lump);
allTexturesContents.Push(lumpContents);
// Find the next TEXTURES lump if present:
lump = Wads.FindLump("TEXTURES", lump + 1);
}