How to set nested array index / array in array

As title says, I need to set an array in an array. I’m not sure what configuration I would use. I am able to set an index of an array, and to draw information from an array within an array, but I’m not sure of what the syntax should look like for setting an index of an array within an array.

It just overwrites the second array with an integer instead of modifying within it. E.g.

Trying to put 1 within a nested array currently results in:
“Array = [(Array), (Array), 1]”
Instead of
“Array = [(Array), (Array), [1, null, null]]”

If there is a specific function that can help with this, I would appreciate if you could tell me, all I’ve been able to find is “set” or “modify player variably at index”.

Not sure if vectors would work (or can even be created in the workshop), I haven’t had time to try them yet.

Does the workshop support nested arrays? I thought it didn’t. I wasn’t sure so I tried testing this:

actions
{
Global.A = Array(Global.B, Global.C);
}

Setting Value in the variable to Array + new elements to other variables.

It shows “array of #” in the inspector and when I use “random global a, random global a” in a string on a small message, it prints

actions
{
Small Message(All Players(All Teams), String("{0}!", Random Value In Array(Random Value 
In Array(Global.A))));
}

It seems to get me random values from global b and c, so I guess it can find values from those other arrays.

If your goal is to make it say [1, null, null], you probably need to create those empty indexes in the other arrays. Try using the Array button in the values drop down. (in my case it would just print 0). Sorry if it doesn’t help, I’m not too sure what you’re trying to do

4DYMK

Making a nested array would look like

actions
{
	Event Player.A[0] = Array(0, 1, 2, 3);
}

If you would want to access information at a specific index from the nested array it would look like

actions
{
	Event Player.B = Event Player.A[2][0];
}

The first set of brackets is for the index of the nested array;
the second set of brackets is for the main array.


Modifying values in nested arrays is impossible.
However you can still modify said array by adding or removing values from it with

actions
{
	Modify Player Variable At Index(Event Player, A, 0, Append To Array, 1);
	Modify Player Variable At Index(Event Player, A, 0, Remove From Array By Value, 1);
}