lua-users home
lua-l archive

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


It was thus said that the Great Andrew Gierth once stated:
> Something like #... to return the number of varargs without needing to
> pass them all to another function as in select('#',...).

  +1.  And ...[i] to reference them.  Example:

	function foo(...)
	  for i = 1 , #... do
	    print(i,...[i])
	  end
	end

or even

	function foo(...)
	  for i,v in ipairs(...) do
	    print(i,v)
	  end
	end

  Although I think that last one might be difficult to pull off.

  -spc