-2

I have a struct array like this:

SmallArray[0].X , SmallArray[0].Y and 
SmallArray[1].X , SmallArray[1].Y and

etc...

Now I have to insert this array to a cell of another array, for example:

BigArray[0] = SmallArray   //Not a single cell but the whole small array

As if the cell point to the small array so I can access to the small array like this:

let variable  = BigArray[0].SmallArray[0].X
let variable2 = BigArray[0].SmallArray[0].Y

and also

let variable3  = BigArray[0].SmallArray[1].X
let variable4  = BigArray[0].SmallArray[1].Y

etc...

1
  • So what is the question exactly? Commented Feb 26, 2018 at 22:00

2 Answers 2

0

Just use:

var variable1 = BigArray[0][0].X
var variable2 = BigArray[0][0].Y
var variable3 = BigArray[0][1].X
var variable4 = BigArray[0][1].Y

etc

Sign up to request clarification or add additional context in comments.

1 Comment

It worked, i lost so much time trying to fix by myself but i gave up. Thank you all guys
0

If your question is how to get an array as a child array to an array then:

var BigArray = [];
BigArray.push(SmallArray);

After this you can reference your values as such:

var x0 = BigArray[0][0].X;
var y0 = BigArray[0][0].Y;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.