Re: [luabind] How to store a object and return it to lua?
Brought to you by:
arvidn,
daniel_wallin
From: Leo Y. <sur...@ya...> - 2003-09-29 05:22:47
|
I did try to return a luabind object but I got an assertion. The cpp code was like the following: class cTest { public: luabind::object _obj; luabind::object& Source( void ) { return _obj; } static cTest* CreateRawPtr( const luabind::object &o ) { cTest *p = new cTest(); p->_obj = o; return p; } } The binding code was like this: module( L ) [ class_< cTest, TestPtr >( "cTest" ) .def( "Source", &cTest::Source ), def( "CreateRawPtr", &cTest::CreateRawPtr, adopt( return_value ) ) ]; Then I used code 'o = t1:Source()' to get my object. I got an assertion that told me 'You are trying to use an unregistered type'. Could you check the above code and tell me what's wrong with it? Best regard. Leo Yee __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |