[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __tostring and string.format
- From: Miles Bader <miles@...>
- Date: Wed, 08 Dec 2010 18:23:28 +0900
Arseny Vakhrushev <arseny.vakhrushev@gmail.com> writes:
>>> Actually, it works well. I mean {...}/unpack() is fully reversible.
>>
>> You're just lucky with your data
>>
>> $ lua -e 'print(select("#", unpack{ 1, nil, 3 }))'
>> 3
>>
>> $ luajit2 -e 'print(select("#", unpack{ 1, nil, 3 }))'
>> 1
>>
>
> Well, I was talking about vanilla Lua. Anyway, the above difference is
> very weird because it doesn't allow to postpone the usage of varargs,
> for instance, in some coroutine create/resume loop where arguments could
> be anything generic. Fortunately, I rely on this behavior only within a
> testing framework which is run under plain Lua.
Sadly, the same is true of vanilla lua:
$ lua -v
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
$ lua -e 'print(select ("#", unpack{ 1, nil, nil, nil, nil, nil,nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 3 }))'
1
-Miles
--
Guilt, n. The condition of one who is known to have committed an indiscretion,
as distinguished from the state of him who has covered his tracks.