lua-users home
lua-l archive

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


The 'select' thingy rocks event though I would prefer (...)[k] instead to avoid a function call! But it's way better than creating a table via {...}.
Alex


>-----Original Message-----
>From: Eric Tetz [mailto:erictetz@gmail.com]
>Sent: Friday, September 03, 2004 2:04 PM
>To: Lua list
>Subject: Re: ... Questions
>
>
>function f(...)
>  print(...)
>end
>
>function f(...)
>  for k,v in {...} do
>    op( v )
>  end
>end
>
>function f(...)
>  for i=1,select('#',...) do
>    op( select(i, ...) )
>  end
>end
>
>Though for anything but very short argument lists (3 or 4), it's
>faster to use 'arg' if you need to iterate -- at least with 5.1w1.
>
>