--- CEGUILua.cpp Thu Jan 29 20:08:43 2009 +++ CEGUILua.cpp Thu Jan 29 10:23:36 2009 @@ -40,7 +40,7 @@ #include "lauxlib.h" } -#include "tolua++.h" +#include "tolua/tolua++.h" // prototype for bindings initialisation function int tolua_CEGUI_open(lua_State* tolua_S); @@ -55,19 +55,45 @@ *************************************************************************/ LuaScriptModule::LuaScriptModule() { + #if LUA_VERSION_NUM >= 501 + static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + #if defined(DEBUG) || defined (_DEBUG) + {LUA_DBLIBNAME, luaopen_debug}, + #endif + {0, 0} + }; + #endif /* LUA_VERSION_NUM >= 501 */ + // create a lua state d_ownsState = true; d_state = lua_open(); // init all standard libraries - luaopen_base(d_state); - luaopen_io(d_state); - luaopen_string(d_state); - luaopen_table(d_state); - luaopen_math(d_state); -#if defined(DEBUG) || defined (_DEBUG) - luaopen_debug(d_state); -#endif + #if LUA_VERSION_NUM >= 501 + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) + { + lua_pushcfunction(d_state, lib->func); + lua_pushstring(d_state, lib->name); + lua_call(d_state, 1, 0); + } + #else /* LUA_VERSION_NUM >= 501 */ + luaopen_base(d_state); + luaopen_io(d_state); + luaopen_string(d_state); + luaopen_table(d_state); + luaopen_math(d_state); + #if defined(DEBUG) || defined (_DEBUG) + luaopen_debug(d_state); + #endif + #endif /* LUA_VERSION_NUM >= 501 */ setModuleIdentifierString(); } --- CEGUILua.h Thu Jan 29 20:08:23 2009 +++ CEGUILua.h Thu Jan 29 10:18:39 2009 @@ -38,7 +38,11 @@ # ifdef CEGUILUA_EXPORTS # define CEGUILUA_API __declspec(dllexport) # else -# define CEGUILUA_API __declspec(dllimport) +# if defined( __MINGW32__ ) +# define CEGUILUA_API +# else +# define CEGUILUA_API __declspec(dllimport) +# endif # endif #else # define CEGUILUA_API --- CEGUILuaFunctor.cpp Thu Jan 29 20:08:38 2009 +++ CEGUILuaFunctor.cpp Thu Jan 29 10:21:45 2009 @@ -39,7 +39,7 @@ #include "lauxlib.h" } -#include "tolua++.h" +#include "tolua/tolua++.h" // Start of CEGUI namespace section namespace CEGUI --- required.h Thu Jan 29 20:08:32 2009 +++ required.h Thu Jan 29 15:01:58 2009 @@ -36,6 +36,9 @@ #define __operator_decrement operator-- #define __operator_dereference operator* +//This is used to keep compilers happy +#define CEGUIDeadException(e) & + #define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent #if defined(_MSC_VER) && !defined(snprintf)