[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata finalization order
- From: Miles Bader <miles@...>
- Date: Sun, 17 Oct 2010 22:29:04 +0900
Francesco Abbate <francesco.bbt@gmail.com> writes:
> As far as I understood all the people that are working with
> complex C++ code use light userdata and C++ reference counting.
For allocated-in/owned-by-C++ objectsI use generally use _normal_
userdata + C++ reference counting: the userdata holds a pointer to the
C++ obj.
The userdata gets GCed as normal by Lua, and if Lua decides to delete
it, that ends up decrementing the C++ reference count, which may delete
the pointed-to C++ object (or not, if there are remaining references
from other C++ objects).
This works very well for me. [Whereas light userdata never seems
particularly useful...]
-Miles
--
Selfish, adj. Devoid of consideration for the selfishness of others.