lua-users home
lua-l archive

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


On Mar 17, 2012, at 12:51 AM, Egor Skriptunoff wrote:

> Question: does generic loop variables indeed 
> sensitive to assigning values to them?

$ lua -v
Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio

for aKey, aValue in ipairs( { 'a', 'b', 'c' } ) do
 print( aKey, aValue )
 aKey = 0
end

> 1	a
> 2	b
> 3	c


for anIndex = 1, 3 do
 print( anIndex )
 anIndex = 0
end

> 1
> 2
> 3

Apparently not sensitive.

http://www.lua.org/manual/5.2/manual.html#3.3.5