[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Seemingly inconsistency between function in a local variable and local function
- From: Sam Roberts <vieuxtech@...>
- Date: Mon, 2 Apr 2012 13:08:55 -0700
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."