No Revisions Have Been Made To This Page
Can you suggest an edit for this page? Click Here
A stack data structure is a so called last-in-first-out
(LIFO) structure. You can push values onto a stack and the
remove them again by popping them from the stack, and 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.
The following functions exist that deal with DS Stacks.