Welcome, Guest! Login | Register
Multi dimensional arrays
Info
Report
476 Posts

In 3drad, the script object accepts this -
  int[][] b= {{1,2}, {3,4}};

But for the life of me i cant figure out what syntax to use to access b[1] for instance.

Anyone know ??

Here's the angel script reference to arrays

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_arrays.html
Created on: 3 months ago
Info
Report
227 Posts

Since you're using a multidimensional array/matrix, access is done by two indices:
int[][] b {{1,2},{3,4}};
iObjectTextSet(OBJ_0,b[0][0]+"");

The multi dimentional array can be represented as:
1 2
3 4

Remember than arrays indexes are counter from 0 to len(array)-1.

By using b[0] you're accessing a array inside the multidimensional matrix.
Created on: 3 months ago
Edited on: 3 months ago
Info
Report
476 Posts

thank you @nicusorn5  , thats what i needed.
here's the proper textset though 😄
iObjectTextSet(OBJ_0, b[0][0]+"");
Created on: 3 months ago
Info
Report
227 Posts

Oh yeah, I edited the post. Thanks for the heads up about that
Created on: 3 months ago
Reply
Preview
Post
Or use the advanced reply form here...
Sponsored