From 866c4c82376ee1fa4edb66256943e8c4669a4ef5 Mon Sep 17 00:00:00 2001 From: Jisk Date: Mon, 13 May 2024 19:02:19 +0000 Subject: [PATCH] Update file lua_infolib.c --- src/lua_infolib.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index eeb1067a3..70f5d736a 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1163,6 +1163,7 @@ enum mobjinfo_e mobjinfo_activesound, mobjinfo_flags, mobjinfo_raisestate, + mobjinfo_string, }; const char *const mobjinfo_opt[] = { @@ -1190,6 +1191,7 @@ const char *const mobjinfo_opt[] = { "activesound", "flags", "raisestate", + "string", NULL, }; @@ -1278,6 +1280,22 @@ static int mobjinfo_get(lua_State *L) case mobjinfo_raisestate: lua_pushinteger(L, info->raisestate); break; + case mobjinfo_string: + mobjtype_t id = info-mobjinfo; + if (id < MT_FIRSTFREESLOT) + { + lua_pushstring(L, MOBJTYPE_LIST[id]+3); + return 1; + } + + id -= MT_FIRSTFREESLOT; + if (id < NUMMOBJFREESLOTS && FREE_MOBJS[id]) + { + lua_pushstring(L, FREE_MOBJS[id]); + return 1; + } + + return 0; default: lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1));