lua-users home
lua-l archive

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


On Wed, May 19, 2010 at 9:01 PM, Alexander Gladysh <agladysh@gmail.com> wrote:
>>> If both do exactly the same, the logical thing to keep would be ipairs,
>>> not the numeric loop.  Simplifies the language.
>
>> FWIW, I would second that. Drop the numeric loop. And keep ipairs alongside the generic for statement.
>
> Err... How would you write this then?
>
> for i = 1, 100 do
>  print("I would never use numeric for again")
> end

for i in function(s, v) if v ~= 100 then return v + 1 end end, nil, 0 do
  print("I would never use numeric for again")
end

(I hope Petite Abeille was being sarcastic)