lua library table registration needs an extra stack clear (is overflowing)

This commit is contained in:
bbbradsmith 2019-06-27 03:14:12 -04:00
parent 705f1c905c
commit 17e36e9882
1 changed files with 2 additions and 1 deletions

View File

@ -6098,6 +6098,7 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
luaL_register(L, "joypad", joypadlib);
luaL_register(L, "zapper", zapperlib);
luaL_register(L, "input", inputlib);
lua_settop(L, 0); // clean the stack, because each call to luaL_register leaves a table on top (eventually overflows)
luaL_register(L, "savestate", savestatelib);
luaL_register(L, "movie", movielib);
luaL_register(L, "gui", guilib);
@ -6106,7 +6107,7 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
luaL_register(L, "cdlog", cdloglib);
luaL_register(L, "taseditor", taseditorlib);
luaL_register(L, "bit", bit_funcs); // LuaBitOp library
lua_settop(L, 0); // clean the stack, because each call to luaL_register leaves a table on top
lua_settop(L, 0);
// register a few utility functions outside of libraries (in the global namespace)
lua_register(L, "print", print);