ScriptSpot home

Forum topic · General Scripting

Get Name of Array and append it to another Array

By Ewok · 2012-04-25

Description

Hi,

I would like to know if it is possible to get the name of an array and to append this name itself to another array.

In my example: have an array called "Top":

Top = #{858..859, 2022..2024, 2050..2052, 2070..2076, 2078}

What I would like to do is append "Top" to an array like this:

MainArray = #("Left","Right","Top",...)
Comments (3)
Branko Živković

Mark bitarray

The "Top" is not a name of array (don't have this property) or array.
It is a simple bitarray.
Use this example:

TopBitArr = #{858..859, 2022..2024, 2050..2052, 2070..2076, 2078}--bitarray
--if you need array then do:
TopArr = TopBitArr as array

--MULTIDIMENSIONAL_ARRAY
MainArray = #(#("Left",#{}),#("Right",#{}),#("Top",TopBitArr))
--End to get array back:
MainArray[3][1]--name
MainArray[3][2]--bitarray

Cool.

Thank you very much! I entered into the world of multidimensional arrays without being aware of it.

Reply to Ewok
Branko Živković

Data Pair

See "DataPair Values" topic in MaxScript Help.
This is also good solution for solving these kind of problem