lua-users home
lua-l archive

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


On Mon, Apr 14, 2014 at 4:34 AM, Thiago L. <fakedme@gmail.com> wrote:
>
> On 14/04/2014 08:28, John Hind wrote:
>>>
>>> Date: Sun, 13 Apr 2014 18:34:07 -0700
>>> Subject: Lua 5.3 Proposal: Bring back pack()/unpack() for storing
>>>         varargs
>>>
>>> Simple and sweet:
>>>
>>> I'd like to see pack()/unpack() added back for compressing a number of
>>> objects on the stack into a userdata and "unpacking" them to where a
>>> vararg might be expected.
>>>
>> It would be neat if Lua could support indexing semantics on the vararg
>> operator:
>>
>> n = #... -- number of varargs.
>> v = ...[2] -- recover vararg by index.
>>
>> - John
>>
>>
> Wouldn't that be like...
> n = select('#',...)
> v = (select(2,...))
>

Yes, that would be the current way you do that.  I think he's saying
he wishes for sugar. :-)