Do garbage collection on luacore

Another lua state that is not freed until end of game,
so clean up the stack and do GC regularly.
This commit is contained in:
Pasi Kallinen
2024-02-03 12:55:07 +02:00
parent e7a7526ea9
commit 0d7fc06eb9
5 changed files with 18 additions and 1 deletions

View File

@@ -487,8 +487,11 @@ can_do_extcmd(const struct ext_func_tab *extcmd)
lua_pushstring(gl.luacore, nhcb_name[NHCB_CMD_BEFORE]);
lua_pushstring(gl.luacore, extcmd->ef_txt);
nhl_pcall_handle(gl.luacore, 2, 1, "can_do_extcmd", NHLpa_panic);
if (!lua_toboolean(gl.luacore, -1))
if (!lua_toboolean(gl.luacore, -1)) {
lua_settop(gl.luacore, 0);
return FALSE;
}
lua_settop(gl.luacore, 0);
}
if (!wizard && (ecflags & WIZMODECMD)) {