-
Notifications
You must be signed in to change notification settings - Fork 5
Parser notes
Dibyendu Majumdar edited this page Aug 10, 2020
·
9 revisions
Lua functions return multiple values. The caller has to decide how many values to accept.
-
If the function call is the last expression in a function argument list, or in a return statement, or in a table constructor then we have to allow unlimited values.
-
If the function call is in an assignment statement (including local declaration) and is the last expression, then the number of return values to accept is equal to corresponding variable plus any excess variables.
-
In all other cases the function return values are truncated to 1 result.
-
If a function call is surrounded by parens then it truncates result to 1 value.