[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Garbage Collector
- From: Edgar Toernig <froese@...>
- Date: Sun, 14 Dec 2003 16:12:41 +0100
Nicolas Noble wrote:
>
> How exactly does the __gc metamethod works ? It just
> seems I'm not using it the right way.
>[...]
> function createobj(n)
> local t = {n = n}, mt
> mt = {__gc = mygc}
> setmetatable(t, mt)
> return t
> end
The __gc method is only for userdata objects. For other
types it's ignored.
Btw, "local t = {n = n}, mt" looks wrong.
Question: should Lua issue an error if there are
more expressions than variable names?
Ciao, ET.