From 9f23a94b8adbdae83648080a73f9201c03ba4e0d Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Sun, 8 Nov 2020 21:09:45 +0100 Subject: Add append_array() method to Array class --- doc/classes/Array.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/classes') diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index d0f90f513d..8ea6848acd 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]. @@ -133,6 +134,21 @@ Appends an element at the end of the array (alias of [method push_back]). + + + + + + + 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] + + -- cgit v1.2.3