1.
Your array fields are structs, so you have to initialize it before you use it:
Code:
array = [];
array[array.size] = spawnStruct();
array[array.size - 1].key = value;
You can initialize an array even without =[] by just calling an index, CoD2 does the rest for you:
Code:
array[0] = spawnStruct();
array[0].key = value;
2.
You have to create the matrix yourself:
Code:
matrix = [];
for( rowID = 0 ; rowID < rowNum ; rowID++ )
{
matrix[rowID] = [];
for( colID = 0 ; colID < colNum ; colID++ )
{
matrix[rowID][colID] = spawnStruct();
matrix[rowID][colID].key = value;
// better way (so CoD2 doesnt access the matrix each call):
struct = spawnStruct();
struct.key = value;
struct.do_stuff_here_with_struct = instead_of_the_matrix_field;
matrix[rowID][colID] = struct;
}
}