lua-users home
lua-l archive

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


> $ lua -e 'print(select ("#", unpack({ 1, nil, nil, nil, nil, nil,nil,
> nil, nil, nil, nil, nil, nil, nil, nil, nil, 3 }, 1, 17)))'
> 17
> 
> What I tend to do is following:
> 
> function f(...)
>  local args = { n=select('#', ...), ... }
>  -- do something with args
>  return unpack(args, 1, args.n)
> end


I am sorry! I was wrong. You really need to store the arg count here in either Lua.

This is what the manual says on unpack: "... By default, i is 1 and j is the length of the list, as defined by the length operator."

// Seny