From 4e66cb67a8b1696e82d50fb507bd793953125d6a Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Wed, 14 May 2025 19:03:29 +0200 Subject: [PATCH] Fix returned mobj/state index in compatmode --- src/deh_lua.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/deh_lua.c b/src/deh_lua.c index 12787801b..5f9940251 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -53,6 +53,14 @@ static inline int lib_freeslot(lua_State *L) INT32 index; if (!DEH_ReadFreeslot(type, word, &index)) { + if (lua_compatmode) + { + if (fastcmp(type, "MT")) + index -= MT_FIRSTFREESLOT; + if (fastcmp(type, "S")) + index -= S_FIRSTFREESLOT; + } + lua_pushinteger(L, index); r++; }