lua-users home
lua-l archive

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


But then what if you said:

x = {}
with x do
  a = tostring( 3 )
End

Would we look up tostring in x, get nil, and then fail on the call?

Or does "with" introduce a new scope for lookups that exists before the
global scope while capturing all assignments? In other words, would:

x = {}
with x do
    a = a
end

Result in copying the value of "a" from the global state and adding it to x
under the key "a". In other words, would it be the same as writing:

x = {}
with x do
    x.a = x.a or a
end

Mark  

on 5/31/03 3:41 PM, Deneb aka Alpha Cygnus at alpha_cygnus@mtu-net.ru wrote:

> it would really be nice if one could type something like this:
> x = {}
> with x do
> a=3
> b=5
> c="this is x.c"
> end
> 
> print(x.a+x.b) --> 8