Hi,
I've created a lua 5.2 patch. As the current version doesn't support lua 5.2 (yet).
Regards,
Joop.
Patch: Lua 5.2 patch
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 4
- Joined: Tue May 01, 2012 21:38
Re: Patch: Lua 5.2 patch
This is the patch (cegui-lua-patch.patch), I cant attach a file.
Code: Select all
diff -Naur CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp
--- CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp 2012-01-22 17:06:01.000000000 +0100
+++ CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/CEGUILua.cpp 2012-05-01 23:04:28.000000000 +0200
@@ -85,7 +85,11 @@
// create a lua state
d_ownsState = true;
+#if LUA_VERSION_NUM > 501
+ d_state = luaL_newstate();
+#else
d_state = lua_open();
+#endif
// init all standard libraries
#if CEGUI_LUA_VER >= 51
diff -Naur CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_event.c CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_event.c
--- CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_event.c 2012-01-22 17:06:01.000000000 +0100
+++ CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_event.c 2012-05-01 22:43:22.000000000 +0200
@@ -23,12 +23,20 @@
static void storeatubox (lua_State* L, int lo)
{
#ifdef LUA_VERSION_NUM
+#if LUA_VERSION_NUM > 501
+ lua_getuservalue(L, lo);
+#else
lua_getfenv(L, lo);
+#endif
if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
lua_pop(L, 1);
lua_newtable(L);
lua_pushvalue(L, -1);
+#if LUA_VERSION_NUM > 501
+ lua_setuservalue(L, lo); /* stack: k,v,table */
+#else
lua_setfenv(L, lo); /* stack: k,v,table */
+#endif
};
lua_insert(L, -3);
lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */
@@ -141,7 +149,11 @@
{
/* Access alternative table */
#ifdef LUA_VERSION_NUM /* new macro on version 5.1 */
+#if LUA_VERSION_NUM > 501
+ lua_getuservalue(L,1);
+#else
lua_getfenv(L,1);
+#endif
if (!lua_rawequal(L, -1, TOLUA_NOPEER)) {
lua_pushvalue(L, 2); /* key */
lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */
diff -Naur CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_map.c CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_map.c
--- CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_map.c 2012-01-22 17:06:01.000000000 +0100
+++ CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_map.c 2012-05-01 22:28:34.000000000 +0200
@@ -263,7 +263,11 @@
lua_pop(L, 1);
lua_pushvalue(L, TOLUA_NOPEER);
};
+#if LUA_VERSION_NUM > 501
+ lua_setuservalue(L, -2);
+#else
lua_setfenv(L, -2);
+#endif
return 0;
};
@@ -271,7 +275,11 @@
static int tolua_bnd_getpeer(lua_State* L) {
/* stack: userdata */
+#if LUA_VERSION_NUM > 501
+ lua_getuservalue(L, -2);
+#else
lua_getfenv(L, -1);
+#endif
if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
lua_pop(L, 1);
lua_pushnil(L);
@@ -411,7 +419,11 @@
lua_rawget(L,-2);
}
else
+#if LUA_VERSION_NUM > 501
+ lua_pushglobaltable(L);
+#else
lua_pushvalue(L,LUA_GLOBALSINDEX);
+#endif
}
/* End module
@@ -445,7 +457,11 @@
else
{
/* global table */
+#if LUA_VERSION_NUM > 501
+ lua_pushglobaltable(L);
+#else
lua_pushvalue(L,LUA_GLOBALSINDEX);
+#endif
}
if (hasvar)
{
@@ -473,7 +489,11 @@
else
{
/* global table */
+#if LUA_VERSION_NUM > 501
+ lua_pushglobaltable(L);
+#else
lua_pushvalue(L,LUA_GLOBALSINDEX);
+#endif
}
if (hasvar)
{
diff -Naur CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_push.c CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_push.c
--- CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_push.c 2012-01-22 17:06:01.000000000 +0100
+++ CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++/tolua_push.c 2012-05-01 22:29:22.000000000 +0200
@@ -79,7 +79,11 @@
#ifdef LUA_VERSION_NUM
lua_pushvalue(L, TOLUA_NOPEER);
+#if LUA_VERSION_NUM > 501
+ lua_setuservalue(L, -2);
+#else
lua_setfenv(L, -2);
+#endif
#endif
}
else
diff -Naur CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++bin/tolua.c CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++bin/tolua.c
--- CEGUI-0.7.6.orig/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++bin/tolua.c 2012-01-22 17:06:01.000000000 +0100
+++ CEGUI-0.7.6/cegui/src/ScriptingModules/LuaScriptModule/support/tolua++bin/tolua.c 2012-05-01 23:04:49.000000000 +0200
@@ -66,7 +66,11 @@
static void add_extra (lua_State* L, char* value) {
int len;
lua_getglobal(L, "_extra_parameters");
+#if LUA_VERSION_NUM > 501
+ len = lua_rawlen(L, -1);
+#else
len = luaL_getn(L, -1);
+#endif
lua_pushstring(L, value);
lua_rawseti(L, -2, len+1);
lua_pop(L, 1);
@@ -85,7 +89,11 @@
lua_State* L = luaL_newstate();
luaL_openlibs(L);
#else
+#if LUA_VERSION_NUM > 501
+ lua_State* L = luaL_newstate();
+#else
lua_State* L = lua_open();
+#endif
luaopen_base(L);
luaopen_io(L);
luaopen_string(L);
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Patch: Lua 5.2 patch
Thanks. Not had a chance to look at this yet.
CE.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “Bug Reports, Suggestions, Feature Requests”
Who is online
Users browsing this forum: No registered users and 13 guests