lua-users home
lua-l archive

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


Replace relocal by local in both examples, in first example will print nil, not 1. Second example identical.

Sent from my iPhone

On 21 Nov 2012, at 18:53, Wesley Smith <wesley.hoke@gmail.com> wrote:

>> local f = 2
>> do
>>        relocal f
>>        print(f) --prints nil as the relocal creates a new local variable, masking the outer f, because there is no f in this scope level
>> end
> 
> Isn't this is what local already does or am I missing something about relocal.
>