[Lua-icxx-users] lua_icxx + swig
Brought to you by:
schoenborno
|
From: Domenico M. <dm...@gm...> - 2012-02-05 15:34:17
|
Hi,
I'm playing around with lua_icxx. I find it very useful with its unique
approach to lua calls within c++.
I'm currently using swig to wrap a large library and I'm using lua_icxx to
provide callback supports from within c++ into lua.
Here is an example
*c++ *
// Note : Foo is wrapped by swig
class Foo
{
public:
LuaFuncRef cb;
void registerCallback(const char* cb)
{
cb = _lua.eval(cb);
}
.....
void execCallback()
{
cb();
}
};
*lua :*
function test()
print("cool")
end
f = Foo()
f:registerCallback("test");
That's all good.
My problem now is to make use of swig wrap to pass c++ objects to lua
callback;
Something like this
void execCallback()
{
cb( new Foo );
}
The callback works fine with basic types but not for UDT.
Any idead how that could be solved ?
Thank you for sharing this lib.
Dom
|