lua-users home
lua-l archive

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


Hello All (already...),

    This is a Lua bug? If you make:

    function x()
            local y,z
    end
    function z()
        local x = 10, y
    end

    Function x will have y and z local, but function z will have only x
local. I think this is a question to Luiz/Roberto.

                                                        The God's Peace,


Leandro.

----- Original Message -----
From: "Edgar Toernig" <froese@gmx.de>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Sunday, December 14, 2003 1:12 PM
Subject: Re: Garbage Collector


> 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.
>