Replace lua_pop(-1) with lua_settop(0)

This commit is contained in:
Louis-Antoine 2020-11-13 15:31:11 +01:00
parent 4fcca22343
commit 04826d2615
2 changed files with 12 additions and 12 deletions

View file

@ -1343,7 +1343,7 @@ void LUAh_GameHUD(player_t *stplayr)
return;
hud_running = true;
lua_pop(gL, -1);
lua_settop(gL, 0);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
@ -1367,7 +1367,7 @@ void LUAh_GameHUD(player_t *stplayr)
lua_pushvalue(gL, -5); // camera
LUA_Call(gL, 3);
}
lua_pop(gL, -1);
lua_settop(gL, 0);
hud_running = false;
}
@ -1377,7 +1377,7 @@ void LUAh_ScoresHUD(void)
return;
hud_running = true;
lua_pop(gL, -1);
lua_settop(gL, 0);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
@ -1392,7 +1392,7 @@ void LUAh_ScoresHUD(void)
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1);
}
lua_pop(gL, -1);
lua_settop(gL, 0);
hud_running = false;
}
@ -1402,7 +1402,7 @@ void LUAh_TitleHUD(void)
return;
hud_running = true;
lua_pop(gL, -1);
lua_settop(gL, 0);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
@ -1417,7 +1417,7 @@ void LUAh_TitleHUD(void)
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1);
}
lua_pop(gL, -1);
lua_settop(gL, 0);
hud_running = false;
}
@ -1427,7 +1427,7 @@ void LUAh_TitleCardHUD(player_t *stplayr)
return;
hud_running = true;
lua_pop(gL, -1);
lua_settop(gL, 0);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
@ -1451,7 +1451,7 @@ void LUAh_TitleCardHUD(player_t *stplayr)
LUA_Call(gL, 4);
}
lua_pop(gL, -1);
lua_settop(gL, 0);
hud_running = false;
}
@ -1461,7 +1461,7 @@ void LUAh_IntermissionHUD(void)
return;
hud_running = true;
lua_pop(gL, -1);
lua_settop(gL, 0);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
@ -1476,6 +1476,6 @@ void LUAh_IntermissionHUD(void)
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1);
}
lua_pop(gL, -1);
lua_settop(gL, 0);
hud_running = false;
}

View file

@ -437,7 +437,7 @@ static void LUA_ClearState(void)
// open base libraries
luaL_openlibs(L);
lua_pop(L, -1);
lua_settop(L, 0);
// make LREG_VALID table for all pushed userdata cache.
lua_newtable(L);
@ -640,7 +640,7 @@ fixed_t LUA_EvalMath(const char *word)
*b = '\0';
// eval string.
lua_pop(L, -1);
lua_settop(L, 0);
if (luaL_dostring(L, buf))
{
p = lua_tostring(L, -1);