ArrayStack < Handle

Last Updated2023-09-27
Created At2014-11-15

Methods12
SymbolDescription
ArrayStackCreates a stack structure. A stack is a LIFO (last in, first out) vector (array) of items. It has O(1) insertion and O(1) removal. Stacks have two operations: Push (adding an item) and Pop (removes items in reverse-push order). The contents of the stack are uniform; i.e. storing a string and then retrieving it as an integer is NOT the same as StringToInt()! The "blocksize" determines how many cells each slot has; it cannot be changed after creation.
ClearClears a stack of all entries.
CloneClones an stack, returning a new handle with the same size and data. This should NOT be confused with CloneHandle. This is a completely new handle with the same data but no relation to the original. It should closed when no longer needed.
PopPops a cell value from a stack.
PopArrayPops an array of cells from a stack.
PopStringPops a string value from a stack.
PushPushes a value onto the end of the stack, adding a new index. This may safely be used even if the stack has a blocksize greater than 1.
PushArrayPushes a copy of an array of cells onto the end of a stack. The cells are pushed as a block (i.e. the entire array takes up one stack slot), rather than pushing each cell individually.
PushStringPushes a copy of a string onto the end of a stack, truncating it if it is too big.
TopReads a cell value from a stack without removing it.
TopArrayReads an array of cells from a stack without removing it.
TopStringReads a string value from a stack without removing it.
Properties3
SymbolTypeDescription
BlockSizeintRetrieve the blocksize the stack was created with.
EmptyboolReturns true if the stack is empty, false otherwise.
Lengthint