lua-users home
lua-l archive

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


> Rolf Kalbermatter <rolf.kalbermatter@kalbermatter.nl> 

> The fact that it doesn’t currently seem to do that (under your
> tested conditions, but who knows if it couldn’t under other
> conditions?) is meaningless. 

I'm not sure how the OP gets the impression that it behaves in a way such that modification of the loop variable would have any effect.

A simple test with Lua 5.1 with the REPL:

> lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> for i=1,10 do
>> print(i)
>> if i==2 then i=6 print("modified i to ", i) end
>> end
1
2
modified i to   6
3
4
5
6
7
8
9
10

This confirms Sean's findings, so all presented evidence so far suggests that this does not work anywhere.

bil til, do you have an example/environment where this works?