diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 773cd6673..495a98db3 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -1086,6 +1086,16 @@ int FWadCollection::FindLump (const char *name, int *lastlump, bool anyns) return -1; } +DEFINE_ACTION_FUNCTION(_Wads, FindLump) +{ + PARAM_PROLOGUE; + PARAM_STRING(name); + PARAM_INT_DEF(startlump); + PARAM_INT_DEF(ns); + const bool isLumpValid = startlump >= 0 && startlump < Wads.GetNumLumps(); + ACTION_RETURN_INT(isLumpValid ? Wads.FindLump(name, &startlump, 0 != ns) : -1); +} + //========================================================================== // // W_FindLumpMulti diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 877c42b2b..97a4d65a2 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -631,7 +631,14 @@ struct Wads ns_firstskin, } + enum FindLumpNamespace + { + GlobalNamespace = 0, + AnyNamespace = 1, + } + native static int CheckNumForName(string name, int ns, int wadnum = -1, bool exact = false); + native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace); } struct TerrainDef native