lua-users home
lua-l archive

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


Dear,

I'm wondering why we can't use multiple returns in expressions like

local a,b,c = f(),g()

Why not stack the result of the expressions on the right side and name the ordered resulting values accordingly?

Detailed:

Suppose Lua 5.4 changes such that

local f = function() return 1,2 end
local g = function() return 3 end

and

local a,b,c,d = f(),g()

would simply do a=1,b=2,c=3,d=nil instead of the current a=1,b=3,c=nil,d=nil.

Moreover, the same on function arguments

s(f(),g()) -> calls s(1,2,3) instead of s(1,3).

Would it be more convenient and predictable?

best,
Rodrigo