Difference between revisions of "Unpack"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Returns the elements from the given table. This function is equivalent to return list[i], list[...")
 
m
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 +
'''Class:''' [[(global)]]<br/>
 +
 
=== Description ===
 
=== Description ===
Returns the elements from the given table. This function is equivalent to  
+
Returns the elements from the given table.
 +
<syntaxhighlight lang="lua">
 +
(multiple) = unpack(list)
 +
</syntaxhighlight>
 +
 
 +
 
 +
The 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.
  
    return list[i], list[i+1], ···, list[j]
+
=== Parameters ===
 +
'''list''': (table) table from which to extract elements<br/>
  
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.
+
=== Return values ===
<source lang="lua">
 
(multiple), = unpack(list,)
 
</source>
 
'''list:''' (table) table from which to extract elements ''''''<br/>
 
 
'''Returns''' (multiple) all values from table as separate values<br/>
 
'''Returns''' (multiple) all values from table as separate values<br/>
 +
 +
{{(global)}}

Latest revision as of 08:40, 12 May 2024

Available since: Gideros 2011.6
Class: (global)

Description

Returns the elements from the given table.

(multiple) = unpack(list)


The 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.

Parameters

list: (table) table from which to extract elements

Return values

Returns (multiple) all values from table as separate values