lua-users home
lua-l archive

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

Also... I remember the local/global thing now...

--> Thursday, January 9, 2003, 9:11:13 AM, you wrote:

>   function f(t)
>    local a,b,c=t.a,t.b,t.c
>    ...
>   end

>>Finally, I can't remember specifically but wasn't there some unpopular
>>global vs local default scope issue that was going to be changed?
>>I think it was simply that local would be implicit instead of global.

> The solution adopted in Lua 5.0 is that every function (including the "main"
> function in each chunk) has its own table of globals, which can be changed.
> With adequate metamethods set for these table of globals, you can have a
> sort of implicit declaration of locals, flag writes to global variables,
> and much more.

In your function f I left above, currently the local keyword is require to
keep a,b,c from going into the global scope. Is that ever going to change?