[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Garbage Collection
- From: Edgar Toernig <froese@...>
- Date: Mon, 27 Aug 2001 04:26:12 +0200
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 ;-)