[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua5.0 new "For" question
- From: "Peter Hill" <corwin@...>
- Date: Mon, 23 Dec 2002 08:00:22 -0000
Vincent Penne:
> One way to get original lua 4 behaviour was
>
> local x=123
> do
> local x = x
> f = function() return %x end
> end
> x = 456
> print (f())
>
> Now this gives 123 with both lua 4 and 5 ...
Hmm. Something I don't understand here.
If I type in the above I get "nil" not "123". But if I wrap it in an extra
"do ... end" it works.
do
local x=123
do
local x = x
f = function() return %x end
end
x = 456
print (f())
end
That doesn't make sense to me.
I type the original one in again (redfining "f" once more) and now I get
"456". What's going on here? =:O
*cheers*
Peter.