lua-users home
lua-l archive

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


On 8 July 2010 12:44, RJ Russell <russellsprouts2@gmail.com> wrote:
> add one new keyword, global, and keep the local keyword.
> Everything is local by default, not overriding any already existing locals, but the global keyword makes a global, and the local keyword creates a new one.
>
> a=1 --auto local
> do
>   a=2 --same one
> end
>
> (Though 5.3work3 with _ENV changes a lot.)
>

I think using the local keyword makes it easier to spot a variable‘s
scope when scanning code. It would be less obvious whether a variable
is a local or an upvalue (or a global declared elsewhere).

Vaughan