Fix error handler staying on lua stack after lua commands being called
This commit is contained in:
parent
28bd0f2f20
commit
23bdf82d2b
1 changed files with 6 additions and 1 deletions
|
|
@ -81,6 +81,9 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
|||
lua_pushstring(gL, buf);
|
||||
}
|
||||
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
|
||||
|
||||
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
|
||||
|
||||
return;
|
||||
|
||||
deny:
|
||||
|
|
@ -142,7 +145,7 @@ void COM_Lua_f(void)
|
|||
if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */
|
||||
{ // Send the command through the network
|
||||
UINT8 argc;
|
||||
lua_pop(gL, 1); // pop command info table
|
||||
lua_pop(gL, 2); // pop command info table and LUA_GetErrorMessage
|
||||
|
||||
if ((flags & COM_ADMIN) && !server && !IsPlayerAdmin(playernum)) // only server/admin can use this command.
|
||||
{
|
||||
|
|
@ -179,6 +182,8 @@ void COM_Lua_f(void)
|
|||
for (i = 1; i < COM_Argc(); i++)
|
||||
lua_pushstring(gL, COM_Argv(i));
|
||||
LUA_Call(gL, (int)COM_Argc(), 0, 1); // COM_Argc is 1-based, so this will cover the player we passed too.
|
||||
|
||||
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
|
||||
}
|
||||
|
||||
// Wrapper for COM_AddCommand
|
||||
|
|
|
|||
Loading…
Reference in a new issue