lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

greetings all,

I've got a toLua question about memory management. I have several C++
functions that allocate some memory, and return the new object to Lua via
the standard toLua bindings. Now, in some cases, I'd really like to be able
to have the right destructor for that object called when the object is
garbage collected from Lua. Other times, I prefer to pass ownership of the
object off to some other C++ class.

I've noticed functions like tolua_takeownership() but cannot figure out how
they are designed to work. Can someone give me a few suggestions? Can toLua
be configured to set the "gc" tag for objects that I want to take ownership

Thanks for your help,