lua-users home
lua-l archive

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


Denis Lamarche wrote:
> 
> Does Lua garbage collect its own variable or those on the stack or both?
> If I set the gc tag of a lua variable to nil, will it still be collected be
> the gc?

Hmm... you can't set tags on variables.  Only on tables and userdata objects.
So I guess you mean that.  Yes, they will be collected.  The gc tag allows
you to set callback functions for userdata objects.  It's just a function
that gets called just before the object is freed.  And the object will be
freed when it's no longer used, whether you set a gc-function or not ;-)

Ciao, ET.