lua-users home
lua-l archive

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

>>>>> "Francisco" == Francisco Olarte <> writes:

 Francisco> Also, note checking for them in lua is difficult ( i.e., in
 Francisco> f(a,b) is not easy to differentiate a call as f(1,nil) from
 Francisco> f(1) , or f(1,2, nil) from f(1,2) ( I only know how to do it
 Francisco> for the first case if I just declare f(...) or f(a,b,...)
 Francisco> for the second and check table.unpack(...).n,

select('#', ...)  is the official way to get the number of items in ...
if you don't otherwise need to table.pack it. (It's kind of irritating
that this takes a function call to do.)