0 votes

Consider this snippet:

    var arr1 = [666]    
    var arr2 = [1,2,3]
    arr1.append_array(arr2)
    print(arr1)

It doesn't work. The compiler responds me:

Invalid call. Nonexistent function 'append_array' in base 'Array'.

But the reference states its existence and its importance.

What is going on, after all? What am I doing wrong?

Godot version 3.2.3
in Engine by (20 points)
edited by

That's because as far as i know no such function exists in the Array class
You will however find it in the subsidiaries of Array like for instance PoolIntArray
if your arrays have multiple data types concatenate using + or explicitly define its type and convert one type to the other before appending

var arr1 : PoolIntArray = [222]    
var arr2 = [1,2,3]
arr1.append_array(arr2)
print(arr1)

The method was actually added to Array in 3.2.4 betas/RCs. It's just that the class reference update was merged too early :)

1 Answer

+3 votes
Best answer

append_array() is for 3.2.4, not 3.2.3. 3.2.3 was released Sept 17, 2020 and the append_array() method merged on Nov 10, 2020.

by (7,190 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.