Difference between revisions of "Unpack"

From GiderosMobile
(remove language stuff)
m
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns the elements from the given table.
 
Returns the elements from the given table.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(multiple) = unpack(list)
 
(multiple) = unpack(list)
</source>
+
</syntaxhighlight>
  
This function is equivalent to
+
 
 +
The 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.
 
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.

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