Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

How would I go about simulating an array or stack? Making a FILO stack is easy but a FIFO stack seems really complicated.

The Octo Repository has a few examples of different approaches to simple data structures and algorithms, and the FAQ has some simple examples of working with memory.

So long as the number of elements fit in a v-register, indexing into an "array" requires setting "i" to the base of the array, adding your offset, and then using load/save. A stack (FILO) requires persistent storage of the index of the top of the stack, perhaps in a reserved v-register. A queue (FIFO) is most easily implemented as a circular buffer, and requires two indices, for a "head" and "tail".