summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-11-10 13:53:58 +0100
committerGitHub <noreply@github.com>2020-11-10 13:53:58 +0100
commit03ae26bb74c0b713fe2132c5b003ae41e366746c (patch)
tree89eb2288855ead545309069fb9c570c43495f469 /doc
parent0efe6dff5f1f973393fcd453d38336f83542786f (diff)
parent9f23a94b8adbdae83648080a73f9201c03ba4e0d (diff)
Merge pull request #43398 from KoBeWi/add_an_array_to_another_array_but_with_a_method
Add append_array() method to Array class
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/Array.xml16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 86ef5bef4c..122c17071b 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -38,6 +38,7 @@
GD.Print(array1 + array2); // Prints [One, 2, 3, Four]
[/csharp]
[/codeblocks]
+ 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>
@@ -149,6 +150,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>