Difference between revisions of "Table.move"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' table<br/> === Description === Copies elements from table src into table dst. Is equivalent to the multi...")
 
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Copies elements from table src into table dst. Is equivalent to the multiple assignment statement: dst[t], ... = src[a], ..., src[b].
 
Copies elements from table src into table dst. Is equivalent to the multiple assignment statement: dst[t], ... = src[a], ..., src[b].
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(table) = table.move(src,a,b,t,dst)
 
(table) = table.move(src,a,b,t,dst)
 
</source>
 
</source>

Revision as of 14:31, 13 July 2023

Available since: Gideros 2022.3
Class: table

Description

Copies elements from table src into table dst. Is equivalent to the multiple assignment statement: dst[t], ... = src[a], ..., src[b]. <syntaxhighlight lang="lua"> (table) = table.move(src,a,b,t,dst) </source>

The default for dst is src. The destination range may overlap with the source range
Returns dst for convenience

Parameters

src: (table) the source table
a: (number) start copying at src[a]
b: (number) copy up to and including src[b]
t: (number) copy into dst[t], ....
dst: (table) destination table optional, default value: "src"

Return values

Returns (table) dst, for convenience