Page 1 of 1

Using the lua state from CEGUILua

Posted: Tue Nov 04, 2008 23:15
by 1337
I'm working on a game project where we use tolua++ ourselves to integrate some c++ functions into lua.
We completely script the GUI happenings in lua and make all calls to a C++ command interpreter. It accepts strings, so we can supply it with almost everything. Sounds like extra work (we could have only used tolua interfaces), but we needed some more flexibility with arguments and temporal restrictions.

Anyway we get a lua state from the scripting module and we call our own FooBar_open() method to initialize our tolua interface. That worked for now except when trying to unload it properly. But that's a smaller issue.

What my mind actually is troubling is the fact that we support both lua 5.1 and 5.0 and both cegui 0.6 and 0.5, where cegui 0.6 supports both lua verions. And I'm guessing mixing both not such a good idea, right?
Currently we've restricted our build system (cmake) to only use lua 5.0 as this is used according to cegui-0.6.1/ScriptingModules/CEGUILua/tolua++bin/README (in v0.5 anyway, no support for lua 5.1 there).
But when building under windows, I have observed that cegui 0.6.1 uses lua 5.1.3. This can be configure in config.lua, but then we can't use the dependencies archive anymore.

What should we do?


About our systems:
Linux (debian, ubuntu, gentoo) and Windows (Visual Studio, MinGW)
We don't build the libraries ourselves under linux, so we have to stick to how the packages have been built. However under windows we supply dependency archives (like cegui), which we build ourselves.
Versions:
CEGUI v0.5 or higher, lua 5.0 or higher, current tolua plus CEGUI modifications with exceptions.

Posted: Wed Nov 05, 2008 14:28
by CrazyEddie
Hi, and welcome :)

Ummmm... :? I think the README file in that directory is the one that comes with tolua++ with a note added with regards to our modifications, so the mention of the Lua 5.0 API is just because that's what the original file said. Though we should probably update that in order to not confuse people.

If you want to use Lua 5.0 with Win32 with CEGUI 0.6.1, you could just delete the newer Lua version in the 0.6.x deps package and replace it with the older Lua version from the 0.5.x dependency package, and then edit the config.lua as you say and regenerate the MSVC++ projects.

With regards to CEGUI 0.5.x only supporting Lua 5.0, you could patch in support for Lua 5.1 if you desire, the code mods were fairly minimal IIRC (I think it's one of the things the Gentoo patch in portage does for 0.5.x so you could look there) - our configure detection of lua version was a more substantial modification, although if you're using prepackaged versions of CEGUI on Linux based platforms you could obviously skip that part anyway. If you are interested in this, and the Gentoo patch route is not doing it for you, ask and I'll try to come up with something.

Umm, so yeah. If you need Lua 5.0 with CEGUI 0.6.1 - use the libs/headers in the CEGUI 0.5.x deps package :)

CE.