ConstTable

This is a wrapper around a dynamic array. When a value is added, ConstTable determines if the value is already in the entries or adds a new entry and returns the index. A ConstTable is shared among all Chunks compiled under the same Compiler.compile call.

Members

Functions

addValue
size_t addValue(ScriptAny value)

add a possibly new value to table and return its index.

addValueUint
uint addValueUint(ScriptAny value)

same as addValue but returns an uint for easy encoding

get
ScriptAny get(size_t index)

get a specific constant

opApply
int opApply(int delegate(size_t index, ScriptAny value) dg)

foreach over const table

seal
void seal()

Seal the const table so that no more constants can be added.

serialize
ubyte[] serialize()

convert const table to ubytes

Static functions

deserialize
ConstTable deserialize(ubyte[] stream)

reads a ConstTable from an ubyte stream

Meta