Data structures

Data structures is a feature that was introduced in Game Maker 6.0. As the name says, data structures are used to store data. Most of this data could also be stored in arrays (single or two-dimensional) to get the same result. The advantage of data structures is that they can be destroyed (they are removed from memory) and they are easy to manage with some Game Maker functions.

Types of data structures

 * Stack
 * A data structure that handles data on a so-called LIFO (Last-In First-Out) basis. The last item that was added to the stack is the first to be removed from it again.


 * Queue
 * A data structure that handles data on a FIFO (First-In First Out) basis. Or: the item that has been added first, will be removed first.


 * List
 * Simply a list. Game Maker contains functions to add, delete, insert, sort and search items in the list. Very similar to single-dimensional arrays.


 * Maps
 * A map stores a key with a value. You can easily find the value that a key holds.


 * Priority queues
 * Also some kind of list structure but here you can specify a priority for each item. Functions exist to find or delete items with high or low priority.


 * Grids
 * In this kind of data structure, you can store values using 2 indices. This is e.g. very useful when you need to store positions of instances. Grids can be compared to two-dimensional arrays.