From b1890385f45db6e133ce4911ee9dd995e0114f60 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 2 May 2021 21:32:07 -0700 Subject: [PATCH] Revert "Merge branch 'lightmemedata' into 'next'" This reverts commit 7ff3e7f18bba50e8d101045252a45b1e49f3d797, reversing changes made to dc37cdf2a6d3476a091e18cf78bf746edf961c83. --- src/lua_baselib.c | 12 +++--------- src/lua_script.c | 21 --------------------- src/lua_script.h | 1 - 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index e77de1a22..83c112509 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -250,16 +250,10 @@ static const char *GetUserdataUType(lua_State *L) // or players[0].powers -> "player_t.powers" static int lib_userdataType(lua_State *L) { - int type; lua_settop(L, 1); // pop everything except arg 1 (in case somebody decided to add more) - type = lua_type(L, 1); - if (type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA) - { - lua_pushstring(L, GetUserdataUType(L)); - return 1; - } - else - return luaL_typerror(L, 1, "userdata"); + luaL_checktype(L, 1, LUA_TUSERDATA); + lua_pushstring(L, GetUserdataUType(L)); + return 1; } // Takes a metatable as first and only argument diff --git a/src/lua_script.c b/src/lua_script.c index 254c510e3..700d20d66 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -758,27 +758,6 @@ fixed_t LUA_EvalMath(const char *word) return res; } -/* -LUA_PushUserdata but no userdata is created. -You can't invalidate it therefore. -*/ - -void LUA_PushLightUserdata (lua_State *L, void *data, const char *meta) -{ - if (data) - { - lua_pushlightuserdata(L, data); - luaL_getmetatable(L, meta); - /* - The metatable is the last value on the stack, so this - applies it to the second value, which is the userdata. - */ - lua_setmetatable(L, -2); - } - else - lua_pushnil(L); -} - // Takes a pointer, any pointer, and a metatable name // Creates a userdata for that pointer with the given metatable // Pushes it to the stack and stores it in the registry. diff --git a/src/lua_script.h b/src/lua_script.h index 88ef02261..7d974aa65 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -91,7 +91,6 @@ typedef enum { LPUSHED_EXISTING, } lpushed_t; -void LUA_PushLightUserdata(lua_State *L, void *data, const char *meta); void LUA_PushUserdata(lua_State *L, void *data, const char *meta); lpushed_t LUA_RawPushUserdata(lua_State *L, void *data);