lua-users home
lua-l archive

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


David Kastrup wrote:
The point is that it does exactly the same that a numeric loop, so
there was no point in keeping it.

If both do exactly the same, the logical thing to keep would be ipairs,
not the numeric loop.  Simplifies the language.  _And_ you can pass
ipairs around, as a function argument, as a data structure element,
whenever the receiver needs any old iterator.  You can't pass a "numeric
loop" around other than wrapping it into a closure.

I'd like ipairs to stay. Otherwise most of my code will be polluted with an additional line, e.g.
  for k = 1, #arr do
    local v = arr[k] -- this wasn't needed with ipairs
    ......
  end

--
Shmuel