PDA

View Full Version : Embarrassed to ask: Global 2D array



GregMalick
07-27-2004, 06:21 PM
You know how when you declare an array at the top of an LScript that it's globally accessible thoughout the program...

myVar;



You know how can promote it to an array with its first use...

myVar += "dingo";
myVar += "Harpo";

etc. and that myVar is now a Global 1D array that was dynamically allocated.



You know how you dynamically allocate a 2D array in a routine....

dim1=layerCount;
dim2=points.size();

var anotherArray[dim1][dim2];



Is there a way to dynamically allocate a 2D array that is Global?

GregMalick
07-27-2004, 11:13 PM
this is Got IT!



testArr;

main
{ [email protected],2,3,4,[email protected];
[email protected],7,8,9,10,[email protected];
[email protected],13,14,15,16,[email protected];
testArr[1] = a1;
testArr[2] = a2;
testArr[2][1]=9; // just playing with an element
testArr[3] = a3;

testit();
}


testit {

error(testArr[3][1]);
}


DISPLAYS 12 as expected