lua-users home
lua-l archive

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



On 3 February 2010 10:14, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
Lexical environments can be used for reading as well. The code below
does the equivalent of "local x,y,z in t":

in t do
       local x,y,z = x,y,z
       ...
end

There's still a repetition but it's like that already in 5.1.

But you'd have to declare x,y,z and locals outside the lexical scope:

local x , y , z
in t do
    x , y , z = x , y , z
end

wait... does that work? I find these lexical envs confusing. (and I don't have a 5.2 on me)

Daurn