Lua_optoption shouldn't change stack state at the end of call now
This commit is contained in:
1 parent
da9d57a624
commit
1747ebf481
1 file changed
+8
-3
+8
-3
@@ -1680,6 +1680,8 @@ void LUA_UnArchiveDemo(void)
|
||||
// For mobj_t, player_t, etc. to take custom variables.
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (lua_isnoneornil(L, narg))
|
||||
return def;
|
||||
|
||||
@@ -1692,8 +1694,11 @@ int Lua_optoption(lua_State *L, int narg, int def, int list_ref)
|
||||
lua_rawget(L, -2);
|
||||
|
||||
if (lua_isnumber(L, -1))
|
||||
return lua_tointeger(L, -1);
|
||||
return -1;
|
||||
result = lua_tointeger(L, -1);
|
||||
|
||||
lua_pop(L, 2); // Pop result and fields table
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1710,4 +1715,4 @@ int Lua_CreateFieldTable(lua_State *L, const char *const lst[])
|
||||
}
|
||||
|
||||
return luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user