From 7bb1a97cb57c681c3b9933b92fbd99787e3373f3 Mon Sep 17 00:00:00 2001 From: Leonardo Laguna Ruiz Date: Sun, 12 Apr 2020 14:42:15 +0300 Subject: [PATCH] Revert "Improves the LuaJIT performance by using luaL_openlibs to initialize the VM" This reverts commit 1e8f89a8fa9fa965f398cccf3af4988aa91a9395. --- src/LuaJITEngine.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/LuaJITEngine.cpp b/src/LuaJITEngine.cpp index 5e87383..1d8d523 100644 --- a/src/LuaJITEngine.cpp +++ b/src/LuaJITEngine.cpp @@ -28,16 +28,12 @@ struct LuaJITEngine : ScriptEngine { return -1; } - // Import the common Lua libraries - luaL_openlibs(L); - // Unloads the unsafe libraries - lua_pushinteger(L, 0); - lua_setglobal(L, "os"); - lua_pushinteger(L, 0); - lua_setglobal(L, "io"); - // Unloads 'require' so 'io' and 'os' cannot be reloaded - lua_pushinteger(L, 0); - lua_setglobal(L, "require"); + // Import a subset of the standard library + luaopen_base(L); + luaopen_string(L); + luaopen_table(L); + luaopen_math(L); + luaopen_bit(L); // Set user pointer lua_pushlightuserdata(L, this);