Arrays Limitation?

How do make arrays that can hold multiple values per index? I’ve looked all around and it seems I can only make arrays that hold 1 number per index, which is very limitting.

It would be great to have an array Object like on construct

Hi, this is not correct. The only “limitation” of an array is that the index has to be a number. The index can represent a structure, an array, a string, a number or a boolean.

1 Like

Welcome. The variables are actually very flexible. The documentation could be better.
You can use various combinations of variable types like arrays with arrays or arrays of structures. Structures with structures. You can set them up in the side bar on the left or through events.

Once a child structure is created, you can copy/paste to add more

At runtime there are various ways

1 Like

Ohh I get it, so I need to create a sub-structure inside an array value to assign more values to that index, makes sense

Thanks for the clarification.

I guess, my next question would be, is it possible to import values to an array from a .js structure file, or any file? As well as export the array values to a .js?

You can convert to and from json. I’m not as familiar with doing it with external files. There are a couple of json extensions that might help. I’ve used json to save/load structures to storage.

Saving and loading an array or structure to storage.

Network [GDevelop wiki]

1 Like

Oh that’s awesome, thanks a lot!

1 Like