lua-users home
lua-l archive

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


> 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