lua-users home
lua-l archive

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


Duncan Cross wrote:
I had an idea for an explicit syntax for this, that overloads the ... operator:

local tbl = {SixValues()..., 7, 8, 9}

- so that, if the "..." keyword immediately follows an expression that
could resolve to multiple values within a comma separated list, they
are expanded. I can't see any way that this could be ambiguous, but I
haven't thought about it all that much, so maybe I am wrong. It also
kind of makes sense as "..." already means "accomodate a variable
number of values", but in this case it would mean a variable number of
*return* values rather than arguments.

-Duncan
Probably best solution I've heard so far, though I'll have to spend more time digging in the wiki as Patrick Donnelly kindly pointed out (thanks for the link though!). Only bad thing is that it look rather odd, but we can/will adapt I guess.

Olivier Hamel