lua-users home
lua-l archive

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

* Michael Bauroth:

> Now my question: Is it possible to simply call the explicit destructor
> of such a base node from Lua side (Lunar approach), so that the C++
> core can remove the hierarchy or is the only way to set the Lua
> variable to nil, so that the garbage collection can make the rest?

Has Lunar special support for calling destructors?

You can call C++ destructors directly, but after that, the entire
object turns into garbage.  You can't call any methods on it.  In
particular, you cannot call the destructor for a second time.  Lunar
needs to keep some flag so that it doesn't perform another call when
the Lua object is GCed.

On top of that, you need obey any destruction order imposed by the C++
library you use.