Data Stack
scripts/vscripts/alyxlib/data/stack.lua
Methods
Push
Push values to the stack.
Parameters
...
Pop
Pop a number of items from the stack.
Parameters
count(optional)
number
Default is 1
Returns
- ...
Top
Peek at a number of items at the top of the stack without removing them.
Parameters
count(optional)
number
Default is 1
Returns
- ...
Bottom
Peek at a number of items at the bottom of the stack without removing them.
Parameters
count(optional)
number
Default is 1
Returns
- ...
Remove
Remove a value from the stack regardless of its position.
Parameters
value
any
MoveToTop
Move an existing value to the top of the stack. Only the first occurance will be moved.
Parameters
value
any
The value to move.
Returns
- boolean
True if value was found and moved.
MoveToBottom
Move an existing value to the bottom of the stack. Only the first occurance will be moved.
Parameters
value
any
The value to move.
Returns
- boolean
True if value was found and moved.
Contains
Get if this stack contains a value.
Parameters
value
any
Returns
- boolean
Length
Return the number of items in the stack.
Returns
- integer
IsEmpty
Get if the stack is empty.
pairs
Helper method for looping.
Returns
-
function -
any[] -
number
i
Functions
Stack
Create a new Stack object.
First value is at the top.
E.g.
Parameters
...
Returns
- Stack