GOOC - Game Oriented Object C
GOOC - Game Oriented Object C
15. Arrays
15. Arrays
An array is a data structure that lets you store one or more read-only elements consecutively in the GOOL data pool. Array elements are indexed beginning at position zero, not one.
Arrays are defined in global scope, that is, outside of any state or subroutine definition. To define an array, you need to write array, its name, and then the list of elements, separated by commas, in a set of braces. Array elements must be integers, and cannot be EIDs. Once defined, referencing arrays translates into a GOOL data pool reference, indexed to where the array begins.
array MyArray1 = { 1, 3, 9, 27, 81 }
Arrays are structures meant to be passed as a parameter for certain instructions, and are usually not meant to have their elements directly accessed inside source code. In Crash 1, the specialized dereference instruction must take a constant element index number. There is never bounds detection for arrays, nor is their size stored anywhere.