DS Stacks

A DS stack is a so called last-in-first-out (LIFO) data structure, similar to a DS queue. You can push values onto a stack and then remove them again by popping them from the stack, where the value that was pushed on the stack most recently is the first to be popped from it again (just think of a stack of coins, where each coin that you add has to be removed again first before you can get to the rest of the coins beneath). Stacks are often used when there are interrupts to handle, or when having recursive functions, or even when constructing a rudimentary AI for your games.

NOTE As with all dynamic resources, data structures take up memory and so should always be destroyed when no longer needed to prevent memory leaks which will slow down and eventually crash your game.

NOTE If you need to check if a data structure exists, you can use the ds_exists function.

The following functions exist that deal with DS stacks: