lua-users home
lua-l archive

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


On Thu, Aug 13, 2009 at 1:19 PM, Peter Cawley<lua@corsix.org> wrote:
> On Thu, Aug 13, 2009 at 1:00 PM, steve donovan<steve.j.donovan@gmail.com> wrote:
>> Now, would this also apply to function argument lists, which is the
>> other place where multiple returns are not discarded if at the end?
>
> According to the BNF description of Lua, the arguments in a function
> call are an expression list, so IMO it should apply here too (and my
> patch does so).

It is part of my original proposal as well - I think it is an
important factor, that this should work consistently anywhere it makes
sense. In fact Peter's tuples.lua example makes me realise that in my
original post I'd actually missed out another case - in the list of
*return* values from a function, e.g.:

-----
function multivalues()
  return 1,2,3
end

function multivalues2()
  return multivalues()..., 4
end
-----

Thank you for creating your patch so quickly, Peter, it is much
appreciated - I was still in the early stages with mine. I've tried it
out here and it works with everything I can think to throw at it. I
can see it's not a trivial change - it does require new opcodes, etc.
- but it doesn't look too drastic to me.

-Duncan