Merge branch 'lua-allow-player' into 'master'

Allow access to players userdata outside levels.

See merge request STJr/SRB2Internal!386
This commit is contained in:
MascaraSnake 2019-10-25 15:40:31 -04:00
commit faf61912a6
2 changed files with 4 additions and 2 deletions

View File

@ -164,6 +164,8 @@ 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 (field == mobj_valid) {
lua_pushboolean(L, 0);
@ -409,6 +411,8 @@ static int mobj_set(lua_State *L)
enum mobj_e field = Lua_optoption(L, 2, mobj_opt[0], mobj_opt);
lua_settop(L, 3);
INLEVEL
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");

View File

@ -25,7 +25,6 @@
static int lib_iteratePlayers(lua_State *L)
{
INT32 i = -1;
INLEVEL
if (lua_gettop(L) < 2)
{
//return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do <block> end'.");
@ -52,7 +51,6 @@ static int lib_getPlayer(lua_State *L)
{
const char *field;
// i -> players[i]
INLEVEL
if (lua_type(L, 2) == LUA_TNUMBER)
{
lua_Integer i = luaL_checkinteger(L, 2);