[luabind] binding class instances to lua
Brought to you by:
arvidn,
daniel_wallin
From: ashy a. <as...@gm...> - 2005-12-25 00:35:25
|
I'm adding some vars to the global table like this: luabind::object g =3D luabind::globals( L ); g[ "equity" ] =3D portfolio->balance(); // returns a float This works fine for floats but i'd like to be able to do it with a class. I have a class that is exposed to lua (so that passing it as arguments to call_member works fine) and i want to be able to expose an instance of it to lua. Something like this: MyClass myclass; g[ "myclass" ] =3D myclass; How would i go about doing that? Will i need to write a template specialization for object_cast or something= ? |