lua-users home
lua-l archive

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


On Thu, Oct 18, 2012 at 12:03 AM, Daurnimator <quae@daurnimator.com> wrote:
> On 18 October 2012 06:28, agentzh <agentzh@gmail.com> wrote:
>> I'm afraid the current behaviour is quite unintuitive. Opinions?
>>
>> Thanks!
>> -agentzh
>>
>
> This question comes up regulary, and the answer always seems to be
> "its intuitive the way it is".
> The number of threads about it suggest this is not the case.
> I hope that we can revisit this for the next lua version.
>
> Other Complaints:
> http://lua-users.org/lists/lua-l/2009-09/msg00482.html "Passing table
> as vararg ( newbie question )"
> http://lua-users.org/lists/lua-l/2010-11/msg00419.html "newbie to lua
> :-) a trivial question..."
> http://lua-users.org/lists/lua-l/2011-06/msg00713.html "pack/unpack"
> http://lua-users.org/lists/lua-l/2011-10/msg00009.html "A very basic
> thing I don't get"
>
> Responses:
> http://lua-users.org/lists/lua-l/2009-06/msg00202.html Luis: "This is
> a bad idea."
> http://lua-users.org/lists/lua-l/2009-08/msg00242.html Duncan Cross's
> solution of repurposing ...
>
> I do like the solution in Duncan's thread (using (DE)TUPLE opcodes),
> but don't really like the syntax (that is, reusing ... after a call)
>

IIRC, there's a patch that adds the ability to write:
function f(n) return n, n+1 end
t = {
    f(0);
    f(2);
    f(4)
}
that would produce the "expected" result, t = {0, 1, 2, 3, 4, 5},
while using commas would keep the current behaviour.

-- 
Sent from my Game Boy.