Function – Lua Returns multiple values ​​as parameters

I have a function (I cannot change it) that returns multiple values:

function f1()
...
return a, b
end

and another function with multiple parameters (I can’t change it):

function f2(x, y, z)
...
end

Is there a way?

f2(f1(), c)

And x is a, y is b, and z is c?

You can’t do this in one line, because f2(f1(),c) replaces f1 The returned result is adjusted to a single value.

I have a function (I can’t change it) that returns multiple values:

 function f1()
...
return a, b
end

and another function with multiple parameters (I can’t change it):

function f2(x, y, z)
...
end

Is there a way?

f2(f1(), c)

And x is a, y is b, and z is c?

You cannot do this in one line because f2(f1(),c) adjusts the result returned by f1 to a single value.

Leave a Comment

Your email address will not be published.