Using luabind, I create a table of objects from C++
luabind::object create_table(lua_State *L)
{
luabind::object result = luabind::newtable(L);
int index = 1;
for ( ... ) {
lua_Object *o = new lua_Object( ... );
result[ index ++ ] = o;
}
return result;
}
I register the function as
module(L)
[
def("create_table", &create_table)
]
and lua_Object as
class_<lua_Object> reg("Object");
reg
.def(constructor<float,float>())
;
module(L) [ reg ];
How can I tell luabind to take ownership of the objects stored in the table ( new lua_Object( ... ) )? What would be a work around?
Thanks -
Replace
with
On a side note, don't you have to register
create_table
withraw(_1)
policy?