[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Explicit call of C++ destructors from within Lua (Lunar based)
- From: Florian Weimer <fw@...>
- Date: Thu, 20 Nov 2008 10:28:05 +0100
* 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.