Add append_array() method to Array class
(cherry picked from commit 9f23a94b8a)
This commit is contained in:
committed by
Rémi Verschelde
parent
f39c71e32d
commit
98774000e2
@ -20,6 +20,7 @@
|
||||
var array2 = [3, "Four"]
|
||||
print(array1 + array2) # ["One", 2, 3, "Four"]
|
||||
[/codeblock]
|
||||
Note that concatenating with [code]+=[/code] operator will create a new array. If you want to append another array to an existing array, [method append_array] is more efficient.
|
||||
[b]Note:[/b] Arrays are always passed by reference. To get a copy of an array which can be modified independently of the original array, use [method duplicate].
|
||||
</description>
|
||||
<tutorials>
|
||||
@ -95,6 +96,21 @@
|
||||
Appends an element at the end of the array (alias of [method push_back]).
|
||||
</description>
|
||||
</method>
|
||||
<method name="append_array">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="array" type="Array">
|
||||
</argument>
|
||||
<description>
|
||||
Appends another array at the end of this array.
|
||||
[codeblock]
|
||||
var array1 = [1, 2, 3]
|
||||
var array2 = [4, 5, 6]
|
||||
array1.append_array(array2)
|
||||
print(array1) # Prints [1, 2, 3, 4, 5, 6].
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="back">
|
||||
<return type="Variant">
|
||||
</return>
|
||||
|
||||
Reference in New Issue
Block a user