Skip to content

Array Manipulation Opcodes ​

This section documents the arrays instructions available in CandleVM.

For operand encodings, see the executable format reference.

Arrays ​

All array instructions require an ObjectRef to an Array. Array indexes accept Byte values or a non-negative integral Number values representable as usize.

Opcode byteOpcodeOperand bytesBehavior
37NewArraydestination: registerAllocates an empty array and stores its ObjectRef value.
38ArrayLendestination: register, array: registerStores the number of elements as a numeric value (Byte for lengths 0–255, otherwise Number).
39ArrayContainsdestination: register, array: register, value: registerStores whether the array contains a Value equal to the given Value.
40ArrayGetdestination: register, array: register, index: registerLoads the element at the index; an index at or beyond length raises ArrayIndexOutOfBounds.
41ArraySetarray: register, index: register, value: registerReplaces an existing element. An index equal to or greater than the length raises ArrayIndexOutOfBounds.
42ArrayInsertarray: register, index: register, value: registerInserts before the index; an index equal to the length appends. An index greater than the length raises ArrayIndexOutOfBounds.
43ArrayRemovearray: register, index: registerRemoves and discards the element at the index; out-of-range indexes raise ArrayIndexOutOfBounds.

Built for the Candle ecosystem · Powered by VitePress.