lua-users home
lua-l archive

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



On 1-Sep-05, at 11:37 AM, Mark Hamburg wrote:

That works. It's still a reasonably low proportionality constant and most
uses of a foreach form would have required generating a closure.

I do recall some limit on the number of upvalues a C function can have. How does this compare to the limits on the number of arguments a function can
take -- i.e., can we fit all of ... into individual upvalues?

Not if ... had a lot of elements. I think eachi would have to use two different strategies: if called with more than maxupval arguments, it would have to create a table and use a different next function.

As an aside, I would find this form useful for other things than ...

Dumb example but illustrative example:

for _, word in eachi("foo", "bar", "glitch") do