lua-users home
lua-l archive

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


On Fri, Sep 08, 2006 at 09:57:20AM +1000, Nick Gammon wrote:
> Yes I see what is happening, but the surprising thing is that local  
> variables behave so much differently to other types of variables.

Surprise depends on your expectations, and that depends more on you
than lua!

Anyhow, the docs are pretty clear:

	Notice that each execution of a local statement defines new local
	variables.

	- http://www.lua.org/manual/5.1/manual.html#2.6

The example shows multiple local variables being created with the same
name. Example does this with a for loop, and your example unrolls the
loop into consecutive local statements, but its the same thing
happening.

Cheers,
Sam