lua-users home
lua-l archive

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


>> "You should not change the value of the control variable during the
>> loop."

>> This REALLY can be dangerous?

>   I tried it, in Lua 5.1, 5.2, 5.3, 5,4 and LuaJIT 2.0:

> They all behaved the same way, and it appears to work like this:
> [...]

If the spec doesn't say it works any particular way, then, yes, it is
dangerous to depend on it.  The computer world is littered with cases
of coders making assumptions because "everything" works that way, only
to be bitten later because the spec doesn't promise it and a new
implementation worked differently.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B