Copy several simple arrays into a structure?

As the title suggests, I have an array called ColorTable which contains several numbers.

i.e. ColorTable[0] = 1, ColorTable[1] = 15, … etc

I want to copy that table into the first “slot” (child?) of a structure, and later after the ColorTable has been modified, save it into another “slot”. (the number of slots will be finite).

The end result would be something like:
SaveSlots {} (the structure)
slot1 = contents of the first ColorTable
slot2 = contents of the second ColorTable
… etc

Later on, I would need to recall one of these tables, by addressing the appropriate “slot” of the structure.

Hope that makes sense!

Thanks again for all the help!

You can copy an array to a structure with JSON. Although, it’s easier to just use the structure instead of moving things back and forth. It depends on your project and preferences.

This uses the scene variable Slot to build the slot name or you can use specific slots.

You can copy the structure’s array back to “simple” array or access the values directly.

To copy from Slot2 to Slot3
image

Thank you very much. When you mentioned starting with a structure would be better, it made me realize it would be much easier to just save the “running” data into my Structure[“Slot0”], then copy that into Slot1, 2, etc based on the user’s actions.

A few seconds of playing with the events and BOOM! It works just fine!

Thanks!

1 Like

You’re welcome. If you don’t use the JSON approach now, you might use it later. Good luck.