Skip to content

Commit

Permalink
pop return value after lua_pcall
Browse files Browse the repository at this point in the history
stack would have been growing for every coroutine yeild in Lua UI Commander script before this fix
  • Loading branch information
neilstephens committed Aug 21, 2024
1 parent 9767cd0 commit 6498c27
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Code/Plugins/LuaUICommander/LuaInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ void LuaInst::Runner(const std::string& args)
//should have a sleep time in ms on the stack (return value)
if(!lua_isinteger(L,-1))
{
lua_pop(L,retc);
completed = true;
lua_gc(L,LUA_GCCOLLECT);
return;
}
auto sleep_time_ms = lua_tointeger(L,-1);
lua_pop(L,retc);
if(sleep_time_ms < 0)
{
completed = true;
Expand Down

0 comments on commit 6498c27

Please sign in to comment.