lua-users home
lua-l archive

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


 > On 4/23/06, Norman Ramsey <nr@eecs.harvard.edu> wrote:
 > >     function output(...)
 > >       for i = 1, table.getn(arg) do --- can't use ipairs b/c arg might be
 > >       nil
 > >         local v = arg[i]
 > >         assert(output_funs[type(v)], "Bad value to output()") (v)
 > >       end
 > >     end
 > >
 > > I am struggling to figure out how to implement this function in Lua 5.1.
 > > How am I to make sure that I get all the arguments when the new #
 > > operator is not specified when some arguments are nil?
 > 
 > The standard library function "select" is quite useful when dealing
 > with the ... expression.  

Aha!  I somehow missed that one.  It seems the 5.1 manual gives
'incompatibilities' with 5.0 but not 'additions'.  Anyway, 'select' is
perfect; thanks.


N