[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __tostring and string.format
- From: Arseny Vakhrushev <arseny.vakhrushev@...>
- Date: Wed, 8 Dec 2010 12:51:59 +0300
> $ 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