lua-users home
lua-l archive

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


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