Loading array from variable

How do I load arrays from a temporaryvariable into their correct arrays. For example the temporaryvariable has two types of arrays stored like [“Lasetrigger”,99.47894999999998,420,822,51,1.3,1,2,1][“CirclePulseTrigger”,176.94869999999992,465,724,2,1.8,1,0.5]

How do I load these each arrays from the variable into their own “actual” array

I need to load the lasertriggers array into the laser array and I need to load the circlepulsetrigger array into a circlepulse array… Also if each the arrays get bigger I want it to also load those in.

Hi @xwilliamsgumboy, does the temp variable array contain only these 2 subarrays?

Yes right now. But they will contain more,since im making an editor I need to save more arrays

This should work.

When this event runs, it stores every subarray in its own array (as subarrays in “actual_array”) and named according to their first child string. Then the second action removes the first child string variable since you only need to store the other variables.

I forgot to mention temp var was a scene variable, not an structure or array

What @insein has suggested stores each array onto a structure named actual_arrays. This is the only way without specifically referencing each array.

The other solution, to put each into a different array variable is:

Can you share a screenshot of the temp variables & arrays from the scene variables editor to better understand how the arrays are stored?

Just create placeholders similar to this:

1 Like

What do you mean by that? A scene variable is one of number, string, boolean, array or structure

it is a string variable

Do you mean they’re stored as JSON strings like this?

tempvar1 = [“Lasetrigger”,99.47894999999998,420,822,51,1.3,1,2,1]
tempvar2 = [“CirclePulseTrigger”,176.94869999999992,465,724,2,1.8,1,0.5]

Yes they are json but both of the arrays are in one tempvar string variable, not individual

So they are all stored as one string. A string of jsonified arrays? When you create this string, can you create an array of arrays, and jsonify that? It’ll be a bit of a pain to work with otherwise.

Yes its true, so should I go with you guys method?

Yes, as both @insein and I based our responses on it being an array of arrays.

1 Like

As @MrMen mentioned, it’s a lot easier to go with array of arrays.

If you don’t want to store the values in separate variable as our first response, then you can store each array as JSON string in the temp_var array.

1 Like