[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: local function xxx and local yyy= function
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 31 Dec 2008 08:48:54 -0200
> Because the scope of "local yyy" doesn't begin until the next statement.
> Makes things like this possible:
> local temp = a + b
> local temp = temp * 2
> Where as if they were the same the second line would throw a arithmetic on
> nil error. (or even worse, that position may be entirely uninitialized).
And even the common idiom such as
local print = print
The "print" on the right-hand side is the global one.