Difference between revisions of "Arrays"

From Final Fantasy XII Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Virtual Machine supports either one or two dimensional arrays. Each variable type can be declared as an array. Accessing indexes is done by pushing values to the stack. So for an array:
+
Virtual Machine supports either one or two dimensional arrays. Each variable type can be declared as an array. Accessing elements is done by pushing values onto the stack. So for an array:
  
 
<code>int array[2][3];</code> accessing element <code>array[0][1]</code> is done by performing operations:
 
<code>int array[2][3];</code> accessing element <code>array[0][1]</code> is done by performing operations:
  
<pre>PUSHII 0
+
<syntaxhighlight lang="asm">
 +
PUSHII 0
 
PUSHII 1
 
PUSHII 1
PUSHV [array]</pre>
+
PUSHV [array]
 +
</syntaxhighlight>
  
 
where <code>[array]</code> is number of variable array in variable table.
 
where <code>[array]</code> is number of variable array in variable table.
 +
[[Category:General]]

Latest revision as of 11:26, 23 July 2019

Virtual Machine supports either one or two dimensional arrays. Each variable type can be declared as an array. Accessing elements is done by pushing values onto the stack. So for an array:

int array[2][3]; accessing element array[0][1] is done by performing operations:

PUSHII 0
PUSHII 1
PUSHV [array]

where [array] is number of variable array in variable table.