stack ![code/__datastructures/stack.dm 1](git.png)
Vars | |
max_elements | Integer. Maximum number of elements the stack can contain. If 0 , has no limit. Defined during New() . |
---|---|
stack | List. Items within the stack. Initially defined during New() . |
Procs | |
Clear | Clears the stack of all entries. |
Copy | Returns a copy of the stack as a new instance of /datum/stack . |
Pop | Returns then removes the rightmost/last element in the stack. |
Push | Adds element to the stack, unless the stack is already at the limit defined by max_elements . |
QdelClear | qdel() s every entry in the stack, then clears the stack. |
Remove | Removes element from the stack, if present. |
RotateLeft | Rotates the entire stack left/backward with the leftmost/first element looping around to the right/end. |
RotateRight | Rotates the entire stack right/forward with the rightmost/last element looping around to the left/beginning. |
Top | Returns the rightmost/last element in the stack. |
is_empty | Checks if the stack is currently empty. Returns boolean. |
Var Details
max_elements ![code/__datastructures/stack.dm 10](git.png)
Integer. Maximum number of elements the stack can contain. If 0
, has no limit. Defined during New()
.
stack ![code/__datastructures/stack.dm 7](git.png)
List. Items within the stack. Initially defined during New()
.
Not intended to reference directly. Instead, see the various procs under /datum/stack
.
Proc Details
Clear
Clears the stack of all entries.
Copy
Returns a copy of the stack as a new instance of /datum/stack
.
Pop
Returns then removes the rightmost/last element in the stack.
Push
Adds element
to the stack, unless the stack is already at the limit defined by max_elements
.
QdelClear
qdel()
s every entry in the stack, then clears the stack.
Remove
Removes element
from the stack, if present.
RotateLeft
Rotates the entire stack left/backward with the leftmost/first element looping around to the right/end.
Returns FALSE
is the stack is empty.
RotateRight
Rotates the entire stack right/forward with the rightmost/last element looping around to the left/beginning.
Returns FALSE
is the stack is empty.
Top
Returns the rightmost/last element in the stack.
is_empty
Checks if the stack is currently empty. Returns boolean.