Lua library module "stack"

Author: Hans van der Meer

The Lua module stack is a C-module for the manipulation of stacks.

API

Remarks

  1. The calling sequences below assume the module has the name stack assigned to it from the require.
  2. Calling stack functions is in object notation with s as the variable name.
  3. Functions that return the stack allow chaining of operations.

Create stack

stack.create([name]) stack with optional name
stack.create(size [,name]) stack, optional initial capacity and name
returns empty stack, create and new are synomyms

Stack fill

s:push(item[,[item[,...]]) push arguments
s:clear() make stack empty
both return stack

Get values

s:pop() pop and top of stack, or nil
s:top() top of stack, or nil

Query state

s:empty() return true/false for stack empty/notempty
s:size(), #s return stack height
s:ident() identity stamp, name or nil
q:print() header plus full contents string
stack.version() return version of module