Lua 5.2.1 support/new way to load Lua modules

Create issue
Issue #913 new
Former user created an issue

Automatic migration. Original reporter: "DEvil HUnter"

Lua 5.2 has a new way how modules must get loaded. With the actual code it workes with lua 5.1 but not with 5.2.

Problematic code: CEGUILua.cpp Line: 95 to 112

take a look at: luaL_openlibs() in linit.c this function does just load all the modules of 5.2 - copy the code or use this function.

i tested it - after this change it workes well again^^

Reproducibility: always

Comments (1)

  1. Former user Account Deleted

    Original reporter: DEvil HUnter

    Index: cegui/include/config.h

    --- cegui/include/config.h (revision 24) +++ cegui/include/config.h (working copy) @@ -12,7 +12,7 @@

    1. define CEGUI_SAMPLES_USE_OGRE
    2. define CEGUI_TINYXML_H "ceguitinyxml/tinyxml.h"
    3. define CEGUI_DEFAULT_XMLPARSER ExpatParser -#define CEGUI_LUA_VER 51 +#define CEGUI_LUA_VER 52
    4. define CEGUI_FALAGARD_RENDERER
    5. if defined(_DEBUG) || defined(DEBUG)
    6. define CEGUI_HAS_BUILD_SUFFIX Index: cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp

    --- cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp (revision 24) +++ cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp (working copy) @@ -67,7 +67,7 @@ initialise and create a lua_State if one was not provided if (!d_state) { - #if CEGUI_LUA_VER >= 51 + #if CEGUI_LUA_VER == 51 static const luaL_Reg lualibs[] = { {"", luaopen_base}, {LUA_LOADLIBNAME, luaopen_package}, @@ -92,7 +92,7 @@

    1. endif

    init all standard libraries - #if CEGUI_LUA_VER >= 51 + #if CEGUI_LUA_VER == 51 const luaL_Reg *lib = lualibs; for (; lib->func; lib++) { @@ -100,6 +100,8 @@ lua_pushstring(d_state, lib->name); lua_call(d_state, 1, 0); } + #elif CEGUI_LUA_VER >=52 + luaL_openlibs(d_state);

    1. else /* CEGUI_LUA_VER >= 51 */ luaopen_base(d_state); luaopen_io(d_state);
  2. Log in to comment