lua-users home
lua-l archive

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


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.