diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 4fe234dee..36b1c3669 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -444,7 +444,7 @@ static int lib_consPrintf(lua_State *L) if (n < 2) return luaL_error(L, "CONS_Printf requires at least two arguments: player and text."); //HUDSAFE - INLEVEL + plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); if (!plr) return LUA_ErrInvalid(L, "player_t"); diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 129339b96..e2826e160 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -165,14 +165,15 @@ static int mobj_get(lua_State *L) enum mobj_e field = Lua_optoption(L, 2, NULL, mobj_opt); lua_settop(L, 2); - INLEVEL - - if (!mo) { + if (!mo || !ISINLEVEL) { if (field == mobj_valid) { lua_pushboolean(L, 0); return 1; } - return LUA_ErrInvalid(L, "mobj_t"); + if (!mo) { + return LUA_ErrInvalid(L, "mobj_t"); + } else + return luaL_error(L, "Do not access an mobj_t field outside a level!"); } switch(field)