Difference between revisions of "Unpack"
From GiderosMobile
Line 3: | Line 3: | ||
'''<translate>Available since</translate>:''' Gideros 2011.6<br/> | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> | ||
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/> | '''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/> | ||
+ | |||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | <translate>Returns the elements from the given table. This function is equivalent to | + | <translate>Returns the elements from the given table. This function is equivalent to |
return list[i], list[i+1], ···, list[j] | return list[i], list[i+1], ···, list[j] | ||
− | + | except that the above code can be written only for a fixed number of elements. By default, i is 1 and j is the length of the list, as defined by the length operator.</translate> | |
<source lang="lua"> | <source lang="lua"> | ||
(multiple) = unpack(list) | (multiple) = unpack(list) | ||
</source> | </source> | ||
+ | |||
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''list''': (table) <translate>table from which to extract elements</translate> <br/> | '''list''': (table) <translate>table from which to extract elements</translate> <br/> | ||
+ | |||
=== <translate>Return values</translate> === | === <translate>Return values</translate> === | ||
'''<translate>Returns</translate>''' (multiple) <translate>all values from table as separate values</translate><br/> | '''<translate>Returns</translate>''' (multiple) <translate>all values from table as separate values</translate><br/> | ||
+ | |||
+ | {{(global)}} |
Revision as of 04:33, 11 February 2020
Available since: Gideros 2011.6
Class: (global)
Description
Returns the elements from the given table. This function is equivalent to
return list[i], list[i+1], ···, list[j]
except that the above code can be written only for a fixed number of elements. By default, i is 1 and j is the length of the list, as defined by the length operator.
(multiple) = unpack(list)
Parameters
list: (table) table from which to extract elements
Return values
Returns (multiple) all values from table as separate values