API: Lua: VM: Getter - ov-studio/Vital.sandbox GitHub Wiki

━ Methods

━ vm::getArgCount()

@Objective: Retrieves argument count (number of elements inside the stack)
int result = vm -> getArgCount();

━ vm::getGlobal()

@Objective: Pushes value of global object's specified index at the top of the stack.
ℹ️ _G[index]
bool result = vm -> getGlobal(std::string index);

━ vm::getBool()

@Objective: Retrieves bool value from stack's specified index.
bool result = vm -> getBool(int index = 1);

━ vm::getString()

@Objective: Retrieves string value from stack's specified index.
std::string result = vm -> getString(int index = 1);

━ vm::getInt()

@Objective: Retrieves number (integer) value from stack's specified index.
int result = vm -> getInt(int index = 1);

━ vm::getFloat()

@Objective: Retrieves number (float) value from stack's specified index.
float result = vm -> getFloat(int index = 1);

━ vm::getDouble()

@Objective: Retrieves number (double) value from stack's specified index.
double result = vm -> getDouble(int index = 1);

━ vm::getTable()

@Objective: Pops topmost value as index of table (located at specified index) and pushes its value at the top of the stack.
ℹ️ index[(topmost value, i.e value at stack index -1)]
bool result = vm -> getTable(int index = 1);

━ vm::getTableField()

@Objective: Fetches value of table (located at specified index) from provided index value and pushes it at the top of the stack.
ℹ️ index[value]
bool result = vm -> getTableField(int value, int index = 1);
bool result = vm -> getTableField(std::string value, int index = 1);

━ vm::getMetaTable()

@Objective: Pushes the metatable of value (located at specified index) at the top of the stack.
ℹ️ index.metatable
bool result = vm -> getMetaTable(int index = 1);
bool result = vm -> getMetaTable(std::string index);

━ vm::getThread()

@Objective: Retrieves thread value from stack's specified index.
vital_ref* result = vm -> getThread(int index = 1);

━ vm::getUserData()

@Objective: Retrieves userdata value from stack's specified index.
void* result = vm -> getUserData(int index = 1);

━ vm::getLength()

@Objective: Retrieves length of value at stack's specified index.
int result = vm -> getLength(int index = 1);