API: JS: VM: Setter - ov-studio/Vital.sandbox GitHub Wiki

━ Methods

━ vm::setGlobal()

@Objective: Pops the topmost value and assigns it to global object's specified index.
ℹ️ _G[index] = (topmost value, i.e value at stack index -1)
void result = vm -> setGlobal(std::string index);

━ vm::setNil()

@Objective: Pushes nil value at the top of the stack.
void result = vm -> setNil();

━ vm::setBool()

@Objective: Pushes provided bool value at the top of the stack.
void result = vm -> setBool(bool value);

━ vm::setString()

@Objective: Pushes provided string value at the top of the stack.
void result = vm -> setString(std::string& value);

━ vm::setNumber()

@Objective: Pushes provided number value at the top of the stack.
void result = vm -> setNumber(int value);
void result = vm -> setNumber(float value);
void result = vm -> setNumber(double value);

━ vm::createArray()

@Objective: Pushes a new empty array value at the top of the stack.
void result = vm -> createArray();

━ vm::createObject()

@Objective: Pushes a new empty object value at the top of the stack.
void result = vm -> createObject();

━ vm::setArray()

@Objective: Pops topmost and second topmost values and appends to the array (located at specified index).
ℹ️ index[(second topmost value, i.e value at stack index -2)] = (topmost value, i.e value at stack index -1)
void result = vm -> setArray(int index = 1);

━ vm::setObject()

@Objective: Pops topmost and second topmost values and appends to the object (located at specified index).
ℹ️ index[(second topmost value, i.e value at stack index -2)] = (topmost value, i.e value at stack index -1)
void result = vm -> setObject(int index = 1);

━ vm::setArrayField()

@Objective: Pops topmost value and appends to the array (located at specified index) at provided index value.
ℹ️ index[value] = (topmost value, i.e value at stack index -1)
void result = vm -> setArrayField(int value, int index = 1);

━ vm::setObjectField()

@Objective: Pops topmost value and appends to the object (located at specified index) at provided index value.
ℹ️ index[value] = (topmost value, i.e value at stack index -1)
void result = vm -> setObjectField(std::string value, int index = 1);

━ vm::createUserData()

@Objective: Pushes a new userdata at the top of the stack and points it to specified pointer.
void result = vm -> createUserData(void* value);

━ vm::setUserData()

@Objective: Pushes provided userdata at the top of the stack.
void result = vm -> setUserData(void* value);

━ vm::setFunction()

@Objective: Pushes provided function at the top of the stack.
void result = vm -> setFunction(vital_exec& value);