[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: list iteration for statement
- From: "John Belmonte" <jvb@...>
- Date: Sat, 9 Jun 2001 01:11:27 +0900
I've implemented this as a power patch (http://lua.swiki.net/5). I haven't
tested it much, but if anyone has a problem send me the details and I should
be able to fix it. I didn't change existing opcode values, so presumably
it's binary compatible.
If anyone should happen to get addicted to this patch (as I suspect I will),
please consider adding your name to the "supporters" field on the wiki page
and let everyone know.
(p.s. To access downloads on Swiki.net, browser cookies must be enabled.)
----- Original Message -----
From: "John Belmonte" <email@example.com>
To: "Multiple recipients of list" <firstname.lastname@example.org>
Sent: Thursday, April 26, 2001 6:15 PM
Subject: list iteration for statement
> I've been thinking it would be nice to have another form of the for
> loop on top of two we have now, for iterating lists:
> for val in list do
> The equivalent in the Lua as it is now:
> for i = 1, getn(list) do
> local val = list[i]
> Such iteration (where the list is not modified) is very common.
> My argument for adding this new form is that it's more terse,
> less error prone (forgetting the local qualifier, etc), and faster
> if the list happens to be a global.
> Any thoughts?