lua-users home
lua-l archive

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


Hi,

Quoting "Cheng, Long" <long.x.cheng@gmail.com>:
> Or is there other
> "proper" ways to handle the objects life cycle? Thanks!
>

Use normal userdata instead of lightuserdata ; associate a
metatable with it, and free memory in the __gc metamethod
(which does not exist for lightuserdata).

You can learn more from :
http://www.lua.org/pil/28.1.html

Cheers,
Matias.