Using multiple parameters and multiple returns
Contents
The retry.call()
function handles multiple arguments and multiple returns.
Multiple Arguments [top]
The retry.call()
function supports multiple arguments, in the form: arg1, arg2,… argN.
Note: Arguments with other names will raise an error:
Multiple Returns [top]
Lua functions can return multiple values from a function, retry.call()
supports this language feature:
Note: When an error occurs there will be only two returns, the first is the error message and the second (last) is the informational message:
Tip: The code that achieves the multiple returns is a bit subtle.
The returns from pcall()
are assigned to a table “R”:
Which is is then unpacked when it is returned from retry.call()
Note: unpack()
is a standard Lua function that returns the elements from a table.