Merge branch 'minor-lua-fixes' into 'next'

Minor Lua Fixes (CONS_Printf and mobj_t.valid)

See merge request STJr/SRB2!1065
This commit is contained in:
James R 2020-07-14 18:32:00 -04:00
commit 30d27ded6e
2 changed files with 6 additions and 5 deletions

View file

@ -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");

View file

@ -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)