How do I parse c2array in javascript ?

Get help using Construct 2

Post » Thu Dec 29, 2016 5:42 am

Hi,

My nodejs server receive this array from C2 (via websocket) , I already have parsed the data with JSON.parse()

console.log(array)

[ [ [ -1 ], [ 0 ], [ 0 ], [ 0 ] ],
[ [ -1 ], [ 0 ], [ 0 ], [ 0 ] ],
[ [ -1 ], [ 0 ], [ 0 ], [ 0 ] ],
[ [ -1 ], [ 0 ], [ 0 ], [ 0 ] ],
[ [ -1 ], [ 0 ], [ 0 ], [ -1 ] ],
[ [ -1 ], [ 0 ], [ 0 ], [ -1 ] ] ]


But for now I didn't find a way to read all the values.
Apparently array[x][y] does not work. because array[0] returns undefined and array[0][0] makes an error.

Can anyone help ? thanks !
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Thu Dec 29, 2016 6:42 pm

I think you need to use another coordinate, because all C2 arrays are inherently 3D.

Try array[x][y][0] or array[x][0][0]
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 56 guests