lua-users home
lua-l archive

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


My apologies to Andy and all.
I <thought> I knew what I was talking about.

Here are links to the relevant spec sections...

http://www.lua.org/manual/4.0/manual.html#4.6

http://www.lua.org/manual/5.0/manual.html#visibility


Responder (i.e. me in this case) RTFM yourself.





-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of
andyfirebird@uk2.net
Sent: Tuesday, January 27, 2004 2:31 PM
To: Lua list
Subject: RE: tables problem



>Foo = 1
>Bar = function() do
>    local Foo = 5
>
>    do
>        local Foo = 7 -- I <think> this is illegal in Lua 4
>        return Foo
>    end
>end

Not only is it not illegal, it works just as well.   Consider my slightly
changed version of your program:

Foo = 1
function Bar()
    local Foo = 5
    do
        local Foo = 7
        print( Foo )
    end
    print( Foo )
end
Bar()
print( Foo )

[1017]~: /usr/bin/lua -f luatest
7
5
1

...three foos in Lua 4 as well.  Which means I *really* have to go back and
read the manual again...