Next: 4.4 Statements Up: 4 The Language Previous: 4.2 Coercion

4.3 Adjustment

Functions in Lua can return many values. Because there are no type declarations, the system does not know how many values a function will return, or how many parameters it needs. Therefore, sometimes, a list of values must be adjusted, at run time, to a given length. If there are more values than are needed, the last values are thrown away. If there are more needs than values, the list is extended with as many nil's as needed. Adjustment occurs in multiple assignment and function calls.


Next: 4.4 Statements Up: 4 The Language Previous: 4.2 Coercion