LuaState๏
Experimental: This class may be changed or removed in future versions.
Inherits: RefCounted < Object
Embedded Luau virtual machine for sandboxed scripting.
Description๏
LuaState wraps a sandboxed Luau VM for embedded scripting from GDScript or C#.
When passing C# callbacks into Luau, wrap them in a Callable before pushing them into the VM.
Tutorials๏
Methods๏
Signals๏
debugbreak(state: LuaState, debug_info: LuaDebug) ๐
There is currently no description for this signal. Please help us by contributing one!
debugstep(state: LuaState) ๐
There is currently no description for this signal. Please help us by contributing one!
interrupt(state: LuaState, gc_state: int) ๐
There is currently no description for this signal. Please help us by contributing one!
Enumerations๏
flags LibraryFlags: ๐
LibraryFlags LIB_BASE = 1
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_COROUTINE = 2
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_TABLE = 4
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_OS = 8
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_STRING = 16
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_BIT32 = 32
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_BUFFER = 64
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_UTF8 = 128
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_MATH = 256
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_DEBUG = 512
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_VECTOR = 1024
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_BLAZIUM = 2048
There is currently no description for this enum. Please help us by contributing one!
LibraryFlags LIB_ALL = 4095
There is currently no description for this enum. Please help us by contributing one!
enum ValueType: ๐
ValueType VALUE_NONE = -1
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_NIL = 0
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_BOOLEAN = 1
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_LIGHTUSERDATA = 2
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_NUMBER = 3
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_VECTOR = 4
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_STRING = 5
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_TABLE = 6
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_FUNCTION = 7
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_USERDATA = 8
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_THREAD = 9
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_BUFFER = 10
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_PROTO = 11
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_UPVAL = 12
There is currently no description for this enum. Please help us by contributing one!
ValueType VALUE_DEADKEY = 13
There is currently no description for this enum. Please help us by contributing one!
enum Status: ๐
Status STATUS_OK = 0
There is currently no description for this enum. Please help us by contributing one!
Status STATUS_YIELD = 1
There is currently no description for this enum. Please help us by contributing one!
Status STATUS_ERRRUN = 2
There is currently no description for this enum. Please help us by contributing one!
Status STATUS_ERRSYNTAX = 3
There is currently no description for this enum. Please help us by contributing one!
Status STATUS_ERRMEM = 4
There is currently no description for this enum. Please help us by contributing one!
Status STATUS_ERRERR = 5
There is currently no description for this enum. Please help us by contributing one!
Status STATUS_BREAK = 6
There is currently no description for this enum. Please help us by contributing one!
enum CoStatus: ๐
CoStatus CO_RUN = 0
There is currently no description for this enum. Please help us by contributing one!
CoStatus CO_SUSPENDED = 1
There is currently no description for this enum. Please help us by contributing one!
CoStatus CO_NORMAL = 2
There is currently no description for this enum. Please help us by contributing one!
CoStatus CO_FINISHED = 3
There is currently no description for this enum. Please help us by contributing one!
CoStatus CO_ERROR = 4
There is currently no description for this enum. Please help us by contributing one!
enum GCOp: ๐
GCOp GC_STOP = 0
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_RESTART = 1
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_COLLECT = 2
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_COUNT = 3
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_COUNTB = 4
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_ISRUNNING = 5
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_STEP = 6
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_SETGOAL = 7
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_SETSTEPMUL = 8
There is currently no description for this enum. Please help us by contributing one!
GCOp GC_SETSTEPSIZE = 9
There is currently no description for this enum. Please help us by contributing one!
Method Descriptions๏
int abs_index(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void arg_error(index: int, message: String) ๐
There is currently no description for this method. Please help us by contributing one!
Callable bind_callable(callable: Callable) static ๐
There is currently no description for this method. Please help us by contributing one!
void break_execution() ๐
There is currently no description for this method. Please help us by contributing one!
bool call_meta(index: int, field: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
bool check_stack(size: int) ๐
There is currently no description for this method. Please help us by contributing one!
void clear_table(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void clone_function(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void clone_table(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void close() ๐
There is currently no description for this method. Please help us by contributing one!
CoStatus co_status(co: LuaState) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
Status cpcall(callable: Callable) ๐
There is currently no description for this method. Please help us by contributing one!
void create_table(narr: int = 0, nrec: int = 0) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
Status do_string(code: String, chunk_name: String = "", env: int = 0, nargs: int = 0, nresults: int = -1, errfunc: int = 0) ๐
There is currently no description for this method. Please help us by contributing one!
void enforce_any(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
PackedByteArray enforce_buffer(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Object enforce_full_userdata(index: int, tname: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
int enforce_integer(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
float enforce_number(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
int enforce_option(index: int, options: PackedStringArray, default: String = "") ๐
There is currently no description for this method. Please help us by contributing one!
void enforce_stack(size: int, message: String) ๐
There is currently no description for this method. Please help us by contributing one!
String enforce_string_inplace(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
StringName enforce_string_name(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void enforce_type(index: int, type: ValueType) ๐
There is currently no description for this method. Please help us by contributing one!
Vector3 enforce_vector3(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool equal(index1: int, index2: int) ๐
There is currently no description for this method. Please help us by contributing one!
void error() ๐
There is currently no description for this method. Please help us by contributing one!
int full_userdata_tag(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
int gc(what: GCOp, data: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool get_argument(level: int, narg: int) ๐
There is currently no description for this method. Please help us by contributing one!
void get_coverage(funcindex: int, callback: Callable) ๐
There is currently no description for this method. Please help us by contributing one!
void get_fenv(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType get_field(index: int, key: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
void get_full_userdata_metatable(tag: int) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType get_global(key: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
LuaDebug get_info(level: int, what: String) ๐
There is currently no description for this method. Please help us by contributing one!
StringName get_light_userdata_name(tag: int) ๐
There is currently no description for this method. Please help us by contributing one!
StringName get_local(level: int, nlocal: int) ๐
There is currently no description for this method. Please help us by contributing one!
LuaState get_main_thread() ๐
There is currently no description for this method. Please help us by contributing one!
bool get_meta_field(index: int, field: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
bool get_metatable(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType get_metatable_named(tname: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
StringName get_namecall() ๐
There is currently no description for this method. Please help us by contributing one!
bool get_read_only(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
ValueType get_table(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
int get_total_bytes(category: int) ๐
There is currently no description for this method. Please help us by contributing one!
StringName get_upvalue(funcindex: int, nupvalue: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
bool is_array(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_boolean(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_buffer(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_c_function(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_full_userdata(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_function(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_light_userdata(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_lua_function(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_main_thread() const ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
bool is_none_or_nil(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_number(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_object(index: int, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_string(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_table(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool is_thread(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
bool is_userdata(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
bool is_vector(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
bool less_than(index1: int, index2: int) ๐
There is currently no description for this method. Please help us by contributing one!
int light_userdata_tag(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool load_bytecode(bytecode: PackedByteArray, chunk_name: String, env: int = 0) ๐
There is currently no description for this method. Please help us by contributing one!
bool load_string(code: String, chunk_name: String, env: int = 0) ๐
There is currently no description for this method. Please help us by contributing one!
bool new_metatable_named(tname: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void open_libs(libs: BitField[LibraryFlags] = 4095) ๐
There is currently no description for this method. Please help us by contributing one!
int opt_integer(index: int, default: int) ๐
There is currently no description for this method. Please help us by contributing one!
float opt_number(index: int, default: float) ๐
There is currently no description for this method. Please help us by contributing one!
String opt_string_inplace(index: int, default: String) ๐
There is currently no description for this method. Please help us by contributing one!
StringName opt_string_name(index: int, default: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
Vector3 opt_vector3(index: int, default: Vector3) ๐
There is currently no description for this method. Please help us by contributing one!
Status pcall(nargs: int, nresults: int, errfunc: int = 0) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void print_where(level: int) ๐
There is currently no description for this method. Please help us by contributing one!
void push_array(value: Array) ๐
There is currently no description for this method. Please help us by contributing one!
String push_as_string(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void push_boolean(b: bool) ๐
There is currently no description for this method. Please help us by contributing one!
void push_callable(value: Callable) ๐
There is currently no description for this method. Please help us by contributing one!
void push_default_object_metatable() ๐
There is currently no description for this method. Please help us by contributing one!
void push_dictionary(value: Dictionary) ๐
There is currently no description for this method. Please help us by contributing one!
void push_full_userdata(obj: Object, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
void push_integer(num: int) ๐
There is currently no description for this method. Please help us by contributing one!
void push_light_userdata(obj: Object, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
void push_nil() ๐
There is currently no description for this method. Please help us by contributing one!
void push_number(num: float) ๐
There is currently no description for this method. Please help us by contributing one!
void push_object(obj: Object, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
void push_string(str: String) ๐
There is currently no description for this method. Please help us by contributing one!
void push_string_name(string_name: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void push_value(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void push_variant(value: Variant) ๐
There is currently no description for this method. Please help us by contributing one!
void push_vector3(vec: Vector3) ๐
There is currently no description for this method. Please help us by contributing one!
void raw_check_stack(size: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool raw_equal(index1: int, index2: int) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType raw_get(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType raw_get_field(index: int, key: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType raw_geti(index: int, n: int) ๐
There is currently no description for this method. Please help us by contributing one!
int raw_iter(index: int, iter: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void raw_set_field(index: int, key: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
void raw_seti(index: int, n: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void register_library(lib_name: StringName, functions: Dictionary) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void reset_thread() ๐
There is currently no description for this method. Please help us by contributing one!
Status resume(narg: int = 0, from: LuaState = null) ๐
There is currently no description for this method. Please help us by contributing one!
Status resume_error(from: LuaState = null) ๐
There is currently no description for this method. Please help us by contributing one!
void sandbox() ๐
There is currently no description for this method. Please help us by contributing one!
void sandbox_thread() ๐
There is currently no description for this method. Please help us by contributing one!
int set_breakpoint(funcindex: int, nline: int, enabled: bool) ๐
There is currently no description for this method. Please help us by contributing one!
void set_call_metamethod(metatable_index: int, callable: Callable) ๐
There is currently no description for this method. Please help us by contributing one!
bool set_fenv(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void set_field(index: int, key: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
void set_full_userdata_metatable(tag: int) ๐
There is currently no description for this method. Please help us by contributing one!
void set_full_userdata_tag(index: int, tag: int) ๐
There is currently no description for this method. Please help us by contributing one!
void set_global(key: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
void set_index_metamethod(metatable_index: int, callable: Callable) ๐
There is currently no description for this method. Please help us by contributing one!
void set_interrupts(enabled: bool) ๐
There is currently no description for this method. Please help us by contributing one!
void set_light_userdata_name(tag: int, name: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
StringName set_local(level: int, nlocal: int) ๐
There is currently no description for this method. Please help us by contributing one!
void set_memory_category(category: int) ๐
There is currently no description for this method. Please help us by contributing one!
void set_metatable(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void set_newindex_metamethod(metatable_index: int, callable: Callable) ๐
There is currently no description for this method. Please help us by contributing one!
void set_read_only(index: int, enabled: bool) ๐
There is currently no description for this method. Please help us by contributing one!
void set_safe_env(index: int, enabled: bool) ๐
There is currently no description for this method. Please help us by contributing one!
void set_single_step(enabled: bool) ๐
There is currently no description for this method. Please help us by contributing one!
void set_table(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
StringName set_upvalue(funcindex: int, nupvalue: int) ๐
There is currently no description for this method. Please help us by contributing one!
String stack_to_string(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
Array to_array(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
bool to_boolean(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
PackedByteArray to_buffer(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Callable to_callable(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Dictionary to_dictionary(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Object to_full_userdata(index: int, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
int to_integer(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Object to_light_userdata(index: int, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
float to_number(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Object to_object(index: int, tag: int = -1) ๐
There is currently no description for this method. Please help us by contributing one!
int to_pointer(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
String to_string_inplace(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
StringName to_string_name(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
LuaState to_thread(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Variant to_variant(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
Vector3 to_vector3(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
ValueType type(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void type_error(index: int, expected: StringName) ๐
There is currently no description for this method. Please help us by contributing one!
StringName type_name(type_id: ValueType) ๐
There is currently no description for this method. Please help us by contributing one!
StringName type_name_for_value(index: int) ๐
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
void xmove(to_state: LuaState, count: int) ๐
There is currently no description for this method. Please help us by contributing one!
void xpush(to_state: LuaState, index: int) ๐
There is currently no description for this method. Please help us by contributing one!
void yield(nresults: int) ๐
There is currently no description for this method. Please help us by contributing one!