GML Overview: Arrays

You can use 1- and 2-dimensional arrays in GML. Simply put the index between square brackets for a 1-dimensional array, and the two indices with a comma between them for 2-dimensional arrays. At the moment you use an index the array is generated.

Each array runs from index 0. So be careful with using large indices because memory for a large array will be reserved. Never use negative indices. The system puts a limit of 32000 on each index and 1000000 on the total size. So for example you can write the following: {   a[0] = 1; for(i=1;i<10;i+=1) {     a[i] = 2*a[i-1]; }   b[4,6] = 32; }

Previous: Accessing Variables Belonging to Other Instances

Next: Built-in Control Statements

Back To GML For Non-Programmers