How do I get the Z width of a specific xy Array position?

Get help using Construct 2

Post » Mon Mar 21, 2016 12:06 am

Hello,

i have a 3 dimensional array like this:
Code: Select all
{
"c2array":true,
"size":[3,3,3],
"data":[
   [
      ["Students"],
      ["Simon"],
      ["Sarah"]
   ],[
      ["Proben"],
      ["Brüche zu Dezimalbrüchen 1","Mathe","Dezimalbrüche"],
      ["Geometrische Flächen","Mathe","Geometrie"]
   ],[
      ["Themen"],
      ["Dezimalbrüche","Mathe"],
      ["Geometrie","Mathe"]
   ]
]
}


How can i get the "depth" of i.e. "Geometrische Flächen"
or
how can i get the "height" of i.e. "Students" ?

Is there a possibility to do sth. like this: myArray.At(0).lengthor myArray.At(1,1).length.

Thank you
B
7
Posts: 5
Reputation: 291

Post » Mon Mar 21, 2016 4:41 pm

The z depth of any given x/y will always be the same as the total depth of the array, even if there is no data in the cells. An empty cell will contain 0 though, so you can make a function loop to check how many cells in that particular row/column are not equal to zero and return the result.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Mon Mar 21, 2016 5:06 pm

May i suggest the 3D Dictionary plugin by Kevin Khantzis ? It is heaven to work with.

forum/plugin-storage-3d-dictionary_t125861
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: lemonizer and 2 guests