lua-users home
lua-l archive

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


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.