Fix: luaL_sandbox leaves value on the stack

This commit is contained in:
Petri Häkkinen 2021-11-30 09:04:34 +02:00
parent 6958716ccd
commit 5f826dc3fb

View file

@ -44,7 +44,7 @@ LUALIB_API void luaL_sandbox(lua_State* L)
lua_pushliteral(L, "");
lua_getmetatable(L, -1);
lua_setreadonly(L, -1, true);
lua_pop(L, 1);
lua_pop(L, 2);
// set globals to readonly and activate safeenv since the env is immutable
lua_setreadonly(L, LUA_GLOBALSINDEX, true);