luabind 'ref'/'unref' problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

luabind 'ref'/'unref' problem

Alexey Larionov
Hi,

I have a problem using luabind and CEGUILua that uses tolua++ in the
same project.

Versions:
    lua - 5.1.4
    luabind - 0.8
    CEGUI - 0.6.2b

It seems that 'ref'/'unref' methods from 'ref.cpp' of luabind conflicts
with 'luaL_ref'/'luaL_unref' and breaks the LUA_REGISTRYINDEX table so
CEGUILua gets wrong object on stack using 'lua_rawgeti'. I've replaced
'ref'/'unref' methods from 'ref.cpp' with calls to
'luaL_ref'/'luaL_unref' methods and it seems all is ok.

The question: why does luabind implement its ref/unref methods and
doesn't use 'luaL_ref'/'luaL_unref'? Will I have other problems with
such replacment?

Thanks,
Lex.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: luabind 'ref'/'unref' problem

Daniel Wallin
Alexey Larionov wrote:

> Hi,
>
> I have a problem using luabind and CEGUILua that uses tolua++ in the
> same project.
>
> Versions:
>     lua - 5.1.4
>     luabind - 0.8
>     CEGUI - 0.6.2b
>
> It seems that 'ref'/'unref' methods from 'ref.cpp' of luabind conflicts
> with 'luaL_ref'/'luaL_unref' and breaks the LUA_REGISTRYINDEX table so
> CEGUILua gets wrong object on stack using 'lua_rawgeti'. I've replaced
> 'ref'/'unref' methods from 'ref.cpp' with calls to
> 'luaL_ref'/'luaL_unref' methods and it seems all is ok.
>
> The question: why does luabind implement its ref/unref methods and
> doesn't use 'luaL_ref'/'luaL_unref'? Will I have other problems with
> such replacment?

IIRC, it was done this way because we didn't want to depend on the
auxiliary library.

It seems like the auxlib (and the rest of the standard libraries) are
actually included in liblua now, at least the bundled Makefile does it
that way, so I guess this is no longer an issue and we should just start
using luaL_ref() instead.

I think we can just remove ref.hpp and use luaL_ref() directly. Patches
are welcome.

--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user