The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

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 (8,550 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 Frequently asked questions and 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 [email protected] with your username.