Select: Difference between revisions
Jump to navigation
Jump to search
imported>Thisismypassphrase m (→Examples) |
imported>Felice Enellen (fix API category) |
||
| Line 22: | Line 22: | ||
* [[Pack|<code>pack()</code>]] | * [[Pack|<code>pack()</code>]] | ||
[[Category:Reference]] | [[Category:Reference]] | ||
[[Category: | [[Category:API]] | ||
[[Category:Lua]] | [[Category:Lua]] | ||
Revision as of 21:33, 11 March 2021
select( index, ... )
- Selects from the given parameters.
- index
-
- Index to return parameters from, or '#' to return number of parameters
- ...
-
- parameters
If index is a number, returns all parameters starting at index index.
If index is '#', returns the number of parameters passed.
Examples
a, b, c = select(4,1,2,3,4,5,6) -- returns 4, 5, 6
print(a) -- prints 4
print(b) -- prints 5
print(c) -- prints 6
print(select('#',1,2,3,nil,nil)) -- prints 5
print(select('#')) -- prints 0