Type Function Library (globals) Return value (varies) Revision Current Public Release (2018.3326) Keywords select
If index is a number, select()
returns all arguments after argument number index. Otherwise, index must be the string #
, and select()
returns the total number of extra arguments it received.
select ( index, ... ) |
-- This example demonstrates how to access individual return values -- from a function that returns multiple values print ( string.find ( "hello hello" , " hel" )) --> 6 9 print ( select (1, string.find ( "hello hello" , " hel" ))) --> 6 print ( select (2, string.find ( "hello hello" , " hel" ))) --> 9 |
-- This example prints the total number of extra arguments passed to the `select()` function print ( select ( "#" , a,b,c)) --> 3 |