luau-vm 0.732.0

Pure-Rust Luau virtual machine, garbage collector, and standard libraries
Documentation
//! Unstable, representation-level VM access.
//!
//! This module is the Rust equivalent of opting into Luau's private VM
//! headers. Its layouts and operations are coupled to this implementation and
//! targeted Luau release; they are not part of the supported embedding API.
//!
//! Transparent handles are non-owning identities. They carry neither a VM
//! lifetime nor a GC root, and copying one does not copy ownership or create a
//! borrow. Constructing a handle requires the correct address, layout, type
//! tag, owning VM, and live allocation. Any operation that can collect,
//! resize, relocate, close, or free VM storage may invalidate handles,
//! cursors, record views, and pointers. Dereferencing any exposed pointer is
//! the caller's unsafe operation.
//!
//! Public layout fields support source-required inspection and mutation. They
//! do not authorize arbitrary construction of VM state or new GC object kinds.

pub use crate::handle::RawHandle;

pub mod api {
    pub use crate::thread::stack::RawStackAccess;
}

pub mod buffer {
    pub use crate::buffer::{Buffer, BufferRuntime, MAX_BUFFER_SIZE, RawBuffer};
}

pub mod builtins {
    pub use crate::builtins::{LUAU_F_TABLE, LuauFastFunction};
}

pub mod call {
    pub use crate::call::{
        CallRuntime, ErrorRuntime, LuaProtectedErrorFrame, Pfunc, ProtectedCall, ThreadStack,
    };
}

pub mod class {
    pub use crate::class::{
        Class, ClassRuntime, Object, ObjectMemberLookup, RawLuauClass, RawLuauObject,
    };
}

pub mod debug {
    pub use crate::debug::DebugRuntime;
}

pub mod function {
    pub use crate::function::{
        Closure, FeedbackVectorSlot, FeedbackVectorSlotCallTarget, FeedbackVectorSlotData,
        FunctionRuntime, LocVar, Proto, RawClosure, RawLocVar, RawLuaClosure, RawNativeClosure,
        RawProto, RawUpVal, RawUpValData, RawUpValOpen, UpVal, UpValOpen,
    };
}

pub mod gc {
    pub use crate::gc::{
        BLACK_BIT, FIXED_BIT, GCS_ATOMIC, GCS_PAUSE, GCS_PROPAGATE, GCS_PROPAGATE_AGAIN, GCS_SWEEP,
        GcBarrier, GcCategoryNamer, GcCycleMetrics, GcHeapEdge, GcHeapNode, GcHeapVisitor,
        GcMetrics, GcObject, GcRuntime, GcStats, RawGcObject, WHITE_BITS, WHITE0_BIT, WHITE1_BIT,
        bit_mask,
    };
}

pub mod layout {
    pub use crate::layout::Align8Byte;
}

pub mod memory {
    pub use crate::memory::{
        GCO_LINK_OFFSET, GcoPageWalk, LUA_PAGE_PADDING, LuaPage, MemoryRuntime, RawLuaPage,
    };
}

pub mod metamethod {
    pub use crate::metamethod::{MetamethodRuntime, TM_N, TmEvent};
}

pub mod number {
    pub use crate::number::{
        LUAI_MAXINT2STR, LUAI_MAXNUM2STR, clamp_f, int_to_str, lerp_f, num_to_str, sign_f,
        str_to_long, str_to_num,
    };
}

pub mod state {
    pub use crate::state::{
        BASIC_CI_SIZE, BASIC_STACK_SIZE, CallInfo, CallInfoCursor, EXTRA_STACK, EmbedderGc,
        EmbedderMark, ExecutionCallbackStorage, ExecutionClose, ExecutionCounterData,
        ExecutionDestroy, ExecutionDisable, ExecutionEnter, ExecutionInlineFunction,
        ExecutionInterrupt, ExecutionMemorySize, ExecutionTypeMapping, GcInterrupt,
        GcInterruptCallback, GcPhase, GlobalState, INITIAL_STACK_SIZE, InterruptKind,
        InterruptRequest, LUA_BREAK, LUA_CALLINFO_HANDLE, LUA_CALLINFO_NATIVE,
        LUA_CALLINFO_OP_YIELD, LUA_CALLINFO_RETURN, LUA_ERRERR, LUA_ERRMEM, LUA_ERRRUN,
        LUA_ERRSYNTAX, LUA_OK, LUA_YIELD, LuaCallbacks, LuaExecutionCallbacks, PatternInterrupt,
        ProtectedErrorAction, ProtectedErrorCallback, RawCallInfo, RawCallInfoSaved,
        RawGlobalState, RawLuaState, RawMainState, ThreadLifecycle, ThreadState, UserAtomCallback,
        UserThreadCallback,
    };
}

pub mod string {
    pub use crate::string::{
        ATOM_UNDEFINED, MAX_STRING_SIZE, RawTString, StringFormatting, StringRuntime, StringTable,
        TString, hash,
    };
}

pub mod table {
    pub use crate::table::{
        LuaNode, LuaNodeCursor, RAW_LUA_NODE_DUMMY, RAW_TKEY_DEAD_KEY, RAW_TKEY_NIL, RawLuaNode,
        RawLuaTable, RawLuaTableFree, RawTKey, TKey, Table, TableRuntime,
    };
}

pub mod userdata {
    pub use crate::userdata::{
        LuaUserdataDirectAccessData, LuaUserdataMark, RawUserdata, TypedUserdata,
        TypedUserdataAccess, TypedUserdataError, Userdata, UserdataRuntime,
        UserdataTypeRegistration, UserdataTypeRegistryAccess,
    };
}

pub mod value {
    pub use crate::value::{
        LUA_O_NIL_OBJECT, NilObject, RAW_TVALUE_NIL, RawTValue, RawValue, TValue, TValueCursor,
        nil_object,
    };
}

pub mod vm {
    pub use crate::vm::{
        PreCallResult, VmCallFrame, VmConversions, VmExecution, VmOperations, get_comp_tm,
        string_compare,
    };
}