[dependencies]
l3i = "3.0"
The crate is l3i. Its modules are public and are reached by their module path
(l3i::runtime::Runtime, l3i::userdata::tagged::register); only the items below are also at
the root.
| Feature | Adds | Module |
|---|---|---|
jit | Luau's code generator, host lowering hooks written in Rust, the IR builder, assembly and IR dumps, the perf log | native_code |
analysis | Luau's type checker, linter, autocomplete and parser over a host source provider; RuntimePlan::check_definitions | analysis |
soft-render | dream-soft-render as the dream.soft_render extension and @dream/soft-render module | soft_render |
bytes | The dream.bytes extension and @dream/bytes module: searching, record strings, varints, the widths and orders buffer lacks, and the bytes.math() receiver lowered under jit | bytes, bytes::numeric |
bytes-codecs | inflate/deflate (zlib, raw, gzip), deflater for one stream in pieces, LZ4 blocks and frames, zstd and LZMA/XZ decoding | bytes::codecs |
bytes-digests | CRC-32, Adler-32, FNV-1a, xxHash, MD5, SHA-1, SHA-256, BLAKE3, one-shot and incremental | bytes::digests |
bytes-crypto | Bytes from the OS CSPRNG, HMAC and its constant-time verification, PKCS#1 v1.5 RSA and ECDSA signing | bytes::crypto |
bytes-text | Decoding and encoding every WHATWG-labelled text encoding | bytes::text |
data | The dream.data extension and @dream/data module: reductions, selections, gather and scatter, element-wise arithmetic, stable argsort and partition over typed buffer spans, with typed receivers lowered under jit | data |
intern | The dream.intern extension and @dream/intern module: pools that turn strings and buffer spans into dense number identities | intern |
intl | The dream.intl extension and @dream/intl module: BCP 47 locale identity, CLDR plural rules and decimal formatting | intl |
tcp | The dream.tcp extension and @dream/tcp module: nonblocking TCP listeners and byte streams over numeric addresses and a bounded, level-triggered readiness poller | tcp |
dns | The dream.dns extension and @dream/dns module: host name resolution through the OS resolver on a bounded worker pool | dns, hostname |
tls | The dream.tls extension and @dream/tls module: verified TLS 1.3 and 1.2 client and server sessions over @dream/tcp streams | tls, hostname |
syntax | The dream.luau extension and @dream/luau module: Luau's own parser, the tree, comments, errors and tokens of a source as tables | syntax |
The default feature set is empty. The game transport is not a feature: dream-net is a
dependency and every runtime plan carries the dream.udp bridge; raw TCP is the tcp feature.
| Page | Covers | Modules |
|---|---|---|
| Runtime | Runtime, RuntimeBuilder, CallScope, CallContext, MemoryCategory, Limits, the profiler statistics, Sandbox, Template, InstanceSpec, CompileOptions, the flag policy, Error, diagnostics helpers, debug names | runtime, runtime::profiler, sandbox, source, flags, error, diagnostics, debug_name |
| Stack and values | Stack, Frame, ValueView, TableView, Type, Scope, Value, Table, Function, FunctionView, CallResults, PushArgs, every conversion type, Options | stack, value, call, convert, options |
| Binding and userdata | bind_function shapes, Call, Param, Return, VarArgs, ArgView, Overload, Variadic, ResultOrError, NilThen, Yield, Break, Userdata, tagged, untagged, MetatableBuilder, iterators, Owned, Borrowed, Storage, StableRef, LuauModule, ModuleBuilder, read-only tables, RequireNavigator, the standard libraries | bind, userdata, module, readonly, require, libraries |
| Direct access and the VM | AtomCatalogue, DirectPlan, Registry, DirectAccess, direct fields, native::enter, the vector buffer writer, GcControl, memory dumps, the buffer cage, embedder GC, Thread, the debug API and RuntimeHooks | direct, native, vector_writer, memory, thread, debug |
| Extensions and primitives | Extension, ExtensionDescriptor, UserdataBuilder, ModuleDecl, TagPolicy, CompilerTypePolicy, RuntimePlan, RuntimePolicy, InstallContext, PackedScalar, Packed, BufferPack, Sequence, Stream, the dream.quat, dream.raster, dream.udp and dream.soft_render extensions | extension, packed, sequence, quat, raster, udp, soft_render |
| Native code and analysis | NativeCodeGen, NativeCodeOptions, NativeCodeHooks, NativeContext, IrBuilder, IrCmd, dumps and execution statistics; Analysis, AnalysisOptions, SourceProvider, Definitions, PlanSources | native_code, analysis |
| The raw C API | The ffi module, TAG_LIMIT, LUAU_VERSION, and the rules for hand-written lua_CFunctions | ffi |
The root§
Re-exported from their modules:
Error, Result error
Runtime runtime
Declared at the root:
pub mod ffi the raw Luau C API (raw::ffi, re-exported)
pub const TAG_LIMIT: u8 254: valid userdata tags are 1..TAG_LIMIT
pub const LUAU_VERSION: &str "0.748"
pub const VERIFIED_TOOLCHAIN: bool whether build.rs found the verified toolchain
Result<T> is std::result::Result<T, l3i::Error> and is what every fallible function in the
crate returns. The raw C API covers ffi and the two VM constants; Building covers VERIFIED_TOOLCHAIN.
Conventions§
- Errors. A function returns
Errfor a host logic error (Error::Logic: misuse of the
API, a registration conflict, a value from another VM) or for a Lua error that a protected
call caught (Error::Runtime). Inside a bound function nothing raises on its own: returning
Err from the callable, or a Result<T> whose Err the binder pushes, raises the message
as the Lua error the script sees. Error::LuaErrorOnStack re-raises the error object already
on top instead of replacing it with a message. Error::Permission is a capability the
runtime policy did not grant, kept apart from Runtime so a denial never reads as an
operating-system failure. Error::ExecutionTimeLimit and Error::MemoryLimit say a runtime
limit ended the call (Error::is_limit). Host-level calls that could raise (a __index
metamethod, a store into a read-only table, a push that runs out of memory or stack) run under
lua_pcall or check first and come back as Err; the same call inside a native call raises
straight through to Luau's pcall.
- Frames.
Stackis the exclusive handle to a thread's stack and never pops. Temporaries go
through a Frame, and every view a frame returns borrows the frame. A scope has at most one
open child frame: opening a sibling panics at its opening line. Inside a bound function read
the arguments before opening a frame, or open the frame from the Call. Runtime::stack
leases the root stack; a second root while one is alive and not suspended in a Lua call
panics. Helpers that take &Runtime lease the root themselves, so call them between root
stacks.
- Receivers are
&T. A userdata can appear in several argument slots of one call, so no
method receives &mut T. Mutation goes through interior mutability in the payload;
tagged::test_mut is the unsafe escape hatch. Bound callables are Fn, not FnMut, for
the same reason: a binding can re-enter itself through Lua.
Result<T>from a bound function raises.Ok(value)pushesvalue's results;Err
raises the message with the caller's location, in luaL_error wording where the C++ binder
had it (invalid argument #2 to 'name' (number expected, got string)).
- Integers. Luau 0.747 has no integer type. Counts, sizes, lengths and small ids push as
numbers, exact or an error past 2^53: i64, u64 and the other Rust integers push numbers.
Opaque 64-bit values (hashes, client and protocol ids) are Bits64, and packed scalars
Packed<T>, each its own type to scripts, compared and keyed by their bits. Reading a plain Rust
integer from a Lua number rounds half away from zero (OpenMW's rule); convert::Exact<T>
refuses a fractional or out-of-range value.
- Time. Watchdog and profiler times are
std::time::Durationon the way in and
milliseconds as f64 in the statistics. The network bridge's transport clock is f64
seconds, monotonic, read from the plan's clock or the host's network_clock, never from a
script. Runtime::clock is Luau's own high-resolution clock in seconds.
- Names are host data. Every native function and userdata type is named under one of the
runtime's debug roots (dreamweave by default); tags, atoms and packed kinds are chosen by
the host or the planner, never by the crate.