Merge pull request #65 from bbbradsmith/lua_stack_fix
extra stack clear for lua library table registration
This commit is contained in:
commit
5b425c72f8
|
@ -6098,6 +6098,7 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
|
||||||
luaL_register(L, "joypad", joypadlib);
|
luaL_register(L, "joypad", joypadlib);
|
||||||
luaL_register(L, "zapper", zapperlib);
|
luaL_register(L, "zapper", zapperlib);
|
||||||
luaL_register(L, "input", inputlib);
|
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, "savestate", savestatelib);
|
||||||
luaL_register(L, "movie", movielib);
|
luaL_register(L, "movie", movielib);
|
||||||
luaL_register(L, "gui", guilib);
|
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, "cdlog", cdloglib);
|
||||||
luaL_register(L, "taseditor", taseditorlib);
|
luaL_register(L, "taseditor", taseditorlib);
|
||||||
luaL_register(L, "bit", bit_funcs); // LuaBitOp library
|
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)
|
// register a few utility functions outside of libraries (in the global namespace)
|
||||||
lua_register(L, "print", print);
|
lua_register(L, "print", print);
|
||||||
|
|
Loading…
Reference in New Issue