The return statement exits the current function, optionally returning values to the caller. For example:
Every function has an implicit return at the end of it, so you don't normally need to put your own, unless you want to return values.
Functions can return multiple values, which can be "captured" by a multiple assignment statement. For example:
If a function returns a function call, then multiple values returned by the calling function are returned. For example:
If a function returns multiple values and those values are used in an expression list, then the multiple values are adjusted to one value (the first) unless they are used in the last or only place. For example:
See Also ...
Lua base functions
(Help topic: lua=return)
Enter a search string to find matching documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.
Gammon Software support
Forum RSS feed ( https://gammon.com.au/rss/forum.xml )