Files
QtGameMaker/help/files/401_07_arrays.html
T

43 lines
1.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Arrays</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>Arrays</h3>
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:
<p>
<blockquote>
<pre>
{
a[0] = 1;
i = 1;
<b>while</b> (i &lt; 10) { a[i] = 2*a[i-1]; i += 1;}
b[4,6] = 32;
}
</pre>
</blockquote>
<!--END-->
</body>
</html>
<!-- KEYWORDS
arrays
2-dimensional arrays
1-dimensional arrays
-->