[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: list iteration for statement
- From: "John Belmonte" <jvb@...>
- Date: Fri, 27 Apr 2001 00:17:13 +0900
Philippe Lhoste wrote:
> A for statement like
> for index, value in exp do block end
>
> I am probably thick (still a newbie here, lurks a lot, doesn't codes much
> Lua yet), but how this differ deeply from your:
> >>>
> for val in list do
> print(val)
> end
> <<<
Table iteration using "for index, value" does not guarantee any ordering,
which is often required for lists. If order is not important it's possible
to use "for index, value" on a list, but be careful about the n field that
may be inserted by some library functions which would cause the iteration to
break.
-John