Pushing newly created luabind::object

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

Pushing newly created luabind::object

Alexander Gladysh
Hi, all!

Say, I have a raw lua_State *, and I need to push some reference to
object of Luabind-registered type there. Am I right that now I have to
do as follows?

      luabind::object luaobj(L, boost::cref(my_reference));
      luaobj.push(L);

Looks like luabind::object constructor already pushes wrapper to my
reference to the state. Can I tell it not to pop?

Thanks,
Alexander.


_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Pushing newly created luabind::object

Arvid Norberg-2
On Jun 20, 2006, at 20:44, Alexander Gladysh wrote:
> Say, I have a raw lua_State *, and I need to push some reference to
> object of Luabind-registered type there. Am I right that now I have to
> do as follows?
>
>       luabind::object luaobj(L, boost::cref(my_reference));
>       luaobj.push(L);
>
> Looks like luabind::object constructor already pushes wrapper to my
> reference to the state. Can I tell it not to pop?

Well, the abstraction level of luabind kindof expects you to store it  
as a luabind object. The functions used internally in luabind to push  
an object have been placed in the luabind::detail namespace. If you  
want to use them, you'll find it at the top of object.hpp.

template <class T>
luabind::detail::push(lua_State*, T);

and

template <class T, class Policies>
luabind::detail::push(lua_State*, T, Policies const&);

--
Arvid Norberg


_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user