Class: Stack

script.Stack(itemsnullable)

Stack Represents the stack of a Script during execution.

Constructor

new Stack(itemsnullable)

Create a stack.

Parameters:
Name Type Attributes Description
items Array.<Buffer> <nullable>

Stack items.

Properties:
Name Type Description
items Array.<Buffer>

Stack items.

length Number

Size of stack.

Source:

Members

length

Get length.

Source:

length

Set length.

Source:

Methods

(static) isStack(obj) → {Boolean}

Test an object to see if it is a Stack.

Parameters:
Name Type Description
obj Object
Source:
Returns:
Type
Boolean

clear() → {Stack}

Clear the stack.

Source:
Returns:
Type
Stack

entries() → {StackIterator}

Instantiate a key and value iterator.

Source:
Returns:
Type
StackIterator

erase(start, end) → {Array.<Buffer>}

Erase stack items.

Parameters:
Name Type Description
start Number
end Number
Source:
Returns:
Type
Array.<Buffer>

format() → {String}

Inspect the stack.

Source:
Returns:

Human-readable stack.

Type
String

get(index) → {Buffer|null}

Get a stack item by index.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
Buffer | null

inject() → {Stack}

Clone the stack.

Source:
Returns:

Cloned stack.

Type
Stack

insert(index, item) → {Buffer}

Insert an item.

Parameters:
Name Type Description
index Number
item Buffer
Source:
Returns:
Type
Buffer

pop() → {Buffer|null}

Pop a stack item.

Source:
See:
  • Array#pop
Returns:
Type
Buffer | null

push(item) → {Number}

Push item onto stack.

Parameters:
Name Type Description
item Buffer
Source:
See:
  • Array#push
Returns:

Stack size.

Type
Number

remove(index) → {Buffer}

Remove an item.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
Buffer

set(index, value) → {Buffer}

Set stack item at index.

Parameters:
Name Type Description
index Number
value Buffer
Source:
Returns:
Type
Buffer

shift() → {Buffer|null}

Shift a stack item.

Source:
See:
  • Array#shift
Returns:
Type
Buffer | null

swap(i1, i2)

Swap stack values.

Parameters:
Name Type Description
i1 Number

Index 1.

i2 Number

Index 2.

Source:

Symbol.iterator() → {StackIterator}

Instantiate a value-only iterator.

Source:
Returns:
Type
StackIterator

toASM(decodenullable) → {String}

Format the stack as bitcoind asm.

Parameters:
Name Type Attributes Description
decode Boolean <nullable>

Attempt to decode hash types.

Source:
Returns:

Human-readable script.

Type
String

toString() → {String}

Convert the stack to a string.

Source:
Returns:

Human-readable stack.

Type
String

unshift(item) → {Number}

Unshift item from stack.

Parameters:
Name Type Description
item Buffer
Source:
See:
  • Array#unshift
Returns:
Type
Number

values() → {StackIterator}

Instantiate a value-only iterator.

Source:
Returns:
Type
StackIterator