[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: list iteration for statement
- From: Reuben Thomas <rrt@...>
- Date: Sun, 29 Apr 2001 15:54:41 +0100 (BST)
> already existed. I'll bet that since for loops were introduced as a way to
> iterate tables, most of us don't use foreach() anymore.
I've only used Lua 4.0, and I use foreach quite a lot in my utility code
(general-purpose routines that iterate over a list and do simple things like
list concatenation, applying a function to each element of a list &c. i.e.
simple functional things. On the other hand, whenever I'm doing more to a
list, I do tend to use for, but only because upvalues are so clumsy.
With proper lexical scoping, I would probably use them more often.
http://sc3d.org/rrt/ | plagiarism, n. the mind burgles