[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: Ben Kelly <ranavin@...>
- Date: Sat, 09 Jan 2010 03:08:47 -0500
Matthew Wild wrote:
>
> It's the opposite of unpack(). If you have, say... a function that
> returns multiple values or a vararg ... then you can't safely use
> {...} and know how many items were returned (in case of some being
> nil). table.pack helps by setting n equal to the number of items (such
> that t.n might not equal #t).
>
> Matthew
Yes, but you can replicate this in one line of lua code, and generally
stuff that simple doesn't get included in the standard library:
function table.pack(...)
return { n = select('#', ...); ... }
end
(Thanks to #lua for this implementation.)
Ben