API: Lua: 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::createTable()

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

━ vm::setTable()

@Objective: Pops topmost and second topmost values and appends to the table (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 -> setTable(int index = 1);

━ vm::setTableField()

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

━ vm::createMetaTable()

@Objective: Pushes a new empty metatable at the top of the stack.
void result = vm -> createMetaTable(std::string value);

━ vm::setMetaTable()

@Objective: Pops the topmost value (table) and assigns it as new metatable to the value (located at specified index).
ℹ️ index.metatable = (topmost value, i.e value at stack index -1)
void result = vm -> setMetaTable(int index = 1);
void result = vm -> setMetaTable(std::string index);

━ vm::createNamespace()

@Objective: Pushes a new namespace (global table) at the top of the stack.
⚠️ Incase if the namespace already exists, it pushes the same instance on the stack.
ℹ️ __G[parent] = {}
void result = vm -> createNamespace(std::string parent);

━ vm::createThread()

@Objective: Pushes a new thread at the top of the stack.
void result = vm -> createThread();

━ 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);