lua-users home
lua-l archive

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


>How to handle nil arguments in vararg functions?

Nil args are handled fine. The exact number of args passed to a vararg
function is the result of select('#',...).

Try this:

 function f(...)
	 print(select('#',...), ...)
 end

 f(1,2,nil,4)
 f(1,nil,3,nil)
 f(1,2,3)

--lhf