lua-users home
lua-l archive

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


I take your point but it doesnt make the code any easier to read. I think:

do local t=table1.table2.table3
  local c = t.a+t.b
end

is clearer. Just an idea. Guess its not necessary. Cheers. So I think all we
need is the "global" keyword?


From: Luiz Henrique de Figueiredo
>I was trying to suggest a mechinism for jumping to the scope of a table,
>like "use x do ... end" in Pascal (was it use? i havent used pascal for a
>while). i think it scans better:
>eg.
>
>table1.table2.table3 = { a=1,b=2 }
>
>use table1.table2.table3 do
>    local c = a+b
>end

How about

do
 local g=globals(table1.table2.table3)
 local c = a+b
 globals(g)
end

--lhf