Two Dimensional Arrays?
by Andrew Son · in Technical Issues · 03/29/2011 (3:34 pm) · 3 replies
Does Torque Script have a problem with two-dimensional arrays? I put one in a datablock and I keep getting an error right where I declare it.
#2
03/29/2011 (6:28 pm)
Thanks for your help! Got it working now! My problem was I wasn't coding it right. I was doing it like this: myArray[0][0]. It also works when I put it inside a datablock! Thank you!
#3
I'm just too used to Tribes 2 scripting where we didn't have that :)
03/29/2011 (8:43 pm)
I guess I learn something new today too. :PI'm just too used to Tribes 2 scripting where we didn't have that :)
Torque Owner Robert Fritzen
Phantom Games Development
To my knowledge, datablocks cannot contain 2d Arrays. However, everything else does allow it:
%array[0, 0] = "this be some text"; new ScriptObject(Matrix) { ThreeByThree[1, 1] = 1; ThreeByThree[1, 2] = 2; ThreeByThree[1, 3] = 3; ThreeByThree[2, 1] = 4; ThreeByThree[2, 2] = 5; ThreeByThree[2, 3] = 6; ThreeByThree[3, 1] = 7; ThreeByThree[3, 2] = 8; ThreeByThree[3, 3] = 9; };