[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: "subtle change" in for loop
- From: Eva Schmidt <es@...>
- Date: Thu, 27 Sep 2007 16:41:30 +0200
I've got a question about the so-called "subtle change in the scope of the
implicit variables of the for statement and for the repeat statement." (see
LuaManual/Imcompabilities with the previous version):
As I found out now, in Lua 5.1 it is no longer possible to increment the
implicit variable due to the fact, that it is a local one now.
while (_step>0 and var<=_limit) or (_step<=0 and var>=_limit) do
var = var + _step
while (step > 0 and var <= limit) or (step <= 0 and var >= limit) do
local v = var
var = var + step
Unfortunately this avoids the popular procedure to increment and therewith skip
an index in a table...
How can/should this be done in Lua 5.1 now??