Skip to main content

Crate luars

Crate luars 

Source

Macros§

impl_simple_userdata
Implement UserDataTrait for types that only need type name and downcast support. These types use metatables for their Lua-visible API (e.g., IO file handles).
lib_module
Builder for creating library modules with functions and values

Structs§

AsyncCallHandle
A reusable async call handle that keeps a runner coroutine alive across multiple calls to the same Lua function.
AsyncThread
Wraps a Lua coroutine as a Rust Future.
CallInfo
Information about a single function call on the call stack This is similar to CallInfo in lstate.h
Chunk
Builder returned by Lua::load, similar to mlua::Chunk.
DebugInfo
Debug information about a function or stack frame. Mirrors C Lua’s lua_Debug struct from lua.h.
Function
Safe wrapper around a callable Lua function handle.
Instruction
Zero-cost abstraction for Lua 5.5 instruction encoding Internally stores a 32-bit instruction following Lua 5.5 format
LibraryModule
A library module containing multiple functions and values
LibraryRegistry
Registry for all Lua standard libraries
Lua
Safe, embedding-oriented Lua runtime.
LuaAnyRef
A generic user-facing reference to any Lua value.
LuaFullError
Rich error type combining LuaError kind with the actual Lua error message.
LuaFunction
LuaFunctionRef
A user-facing reference to a Lua function (Lua closure, C function, or Rust closure).
LuaProto
Compiled chunk (bytecode + metadata)
LuaState
Execution state for a Lua thread/coroutine This is separate from LuaVM (global_State) to support multiple execution contexts
LuaString
Safe handle to a Lua string kept alive in the registry.
LuaStringRef
A user-facing reference to a Lua string.
LuaTable
LuaTableRef
A user-facing reference to a Lua table.
LuaUserdata
Userdata - arbitrary Rust data with optional metatable.
LuaVM
Global VM state (equivalent to global_State in Lua C API) Manages global resources shared by all execution threads/coroutines
LuaValue
Lua 5.5 TValue structure (16 bytes)
OpaqueUserData
Wraps any T: 'static as an opaque Lua userdata.
PreloadModule
A simple require()-loadable preload module.
RefUserData
A userdata wrapper that holds a raw pointer to an external T: UserDataTrait.
SafeOption
Scope
Lexical scope for non-'static Lua values.
ScopedFunction
A Lua function handle tied to a lexical scope.
ScopedUserData
Borrowed userdata handle tied to a lexical scope.
Table
Safe wrapper around a Lua table handle.
TableBuilder
Fluent builder for Lua tables.
UserDataBuilder
Builder for creating userdata from arbitrary types.
UserDataRef
A typed user-facing reference to Lua userdata.
Value
Safe handle to any Lua value stored in the registry.

Enums§

AsyncReturnValue
Return value from an async function.
LuaError
Lightweight error enum - only 1 byte! Actual error data stored in VM to reduce Result size
LuaValueKind
OpCode
Complete Lua 5.5 Opcode Set (86 opcodes) Based on lopcodes.h from Lua 5.5.0
Stdlib
UdValue
Intermediate value type for userdata field/method returns.

Constants§

LUA_MASKCALL
LUA_MASKCOUNT
LUA_MASKLINE
LUA_MASKRET

Traits§

FromLua
Convert a LuaValue into a Rust type.
FromLuaMulti
Convert a Lua multi-return list into a Rust type.
IntoAsyncLua
Convert a Rust value into async Lua return values without access to a live LuaState.
IntoLua
Convert a Rust type into a LuaValue and push it.
LuaEnum
Trait for Rust enums that can be exported to Lua as a table of constants.
LuaLibrary
Unified installation interface for libraries provided by luars or external crates.
LuaMethodProvider
Blanket trait providing a default no-op method lookup.
LuaRegistrable
Trait for types that can be registered with Lua via register_type_of::<T>.
LuaStaticMethodProvider
Blanket trait providing a default empty static methods list.
UserDataTrait
Describes how a userdata type can be accessed from Lua.

Functions§

deserialize_chunk
Deserialize binary data to a Chunk
deserialize_chunk_with_strings
Deserialize binary data to a Chunk, returning string constants separately
deserialize_chunk_with_strings_vm
Deserialize binary data to a Chunk, directly creating strings with VM
serialize_chunk
Serialize a Chunk to binary format (with string deduplication but no VM strings)
serialize_chunk_with_pool
Serialize a Chunk to binary format (requires ObjectPool for string access)

Type Aliases§

AsyncFuture
Type-erased async future stored in LuaState.pending_future. Returns AsyncReturnValues which are converted to LuaValues by the AsyncThread using the VM’s string interner. Not Send — must run on a single-threaded / LocalSet executor.
CFunction
C Function type - Rust function callable from Lua Now takes LuaContext instead of LuaVM for better ergonomics
LuaResult
RustCallback
Rust closure callback — can capture arbitrary Rust state via Box

Attribute Macros§

lua_methods
Attribute macro on impl blocks — exposes public methods to Lua.

Derive Macros§

LuaUserData
Derive UserDataTrait for a struct or enum.