Confused about passing arrays as reference (Godot 4.1.1)

made a simple script to illustrate the issue. This is a global script and scene script:


When I run the scene, the output is this:
[ ]

My question is that if setting one array equal to another creates a reference to the array, why is scene_array blank but global_array filled?

Because assigning to it creates a new reference

If you append to it you share the results



Thanks a lot!

1 Like