lua-users home
lua-l archive

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


Pablo Saldo wrote:
> 
> Hy everybody,
> How can I "explode" a table in a local scope like:
> 
> t = { foo=1, bar=2}
> foo = 2
> 
> function foobaz()
>   local_explode(t)
>   local baz = foo + bar  -- baz = 3 (not 4)
> end
> 
> print(foo) -- 2 (not 1)

No way.  Locals are bound during compile time.  You could try
fiddling around with the globals table but I wouldn't recommend
that.

Ciao, ET.