lua-users home
lua-l archive

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


On Mon, Apr 2, 2012 at 7:38 AM, Robert Klemme
<shortcutter@googlemail.com> wrote:
> On Mon, Apr 2, 2012 at 2:33 PM, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
>> 2012/4/2 Robert Klemme <shortcutter@googlemail.com>:
>>> Why is that?  What did I overlook?
>>
>> Every time you write the keyword "local", you create/declare a new
>> local variable, which can shadow another one with the same name.
>
> Ah!  I wasn't aware of that.  Page http://www.lua.org/pil/4.2.html
> does not mention this.

The examples on that page show shadowing of local variable names.

Also: "The scope begins after the declaration and goes until the end
of the block."