Skip to main content

Crate lua_types

Crate lua_types 

Source
Expand description

Lua value types, error types, and shared newtypes.

Phase B foundation: this crate defines the types referenced by all Phase A files. Implementations are stubs (todo!()) where they exist; the goal is that use lua_types::... imports resolve so cargo check can surface real errors instead of name-resolution noise.

See PORT_STRATEGY.md §3 for the design decisions encoded here.

Re-exports§

pub use closure::LuaClosure;
pub use closure::LuaLClosure;
pub use error::LuaError;
pub use error::LuaExit;
pub use filehandle::LuaFileHandle;
pub use gc::GcRef;
pub use proto::AbsLineInfo;
pub use proto::LocalVar;
pub use proto::LuaProto;
pub use proto::UpvalDesc;
pub use status::LuaStatus;
pub use string::LuaString;
pub use table::LuaTable;
pub use upval::UpVal;
pub use upval::UpValState;
pub use userdata::LuaUserData;
pub use value::F2Imod;
pub use value::LuaValue;

Modules§

arith
Arithmetic operations — used by lvm’s arith dispatch.
closure
LuaClosure — the function variant of LuaValue. Three sub-kinds: Lua closure (compiled Proto + upvalues), C closure (function pointer + upvalues), light C function (function pointer, no upvalues).
error
LuaError and its canonical constructors. PORT_STRATEGY §3.7, PORTING.md §6.
filehandle
Minimal file-handle abstraction shared between lua-vm (hook type) and lua-stdlib (io library).
gc
GcRef<T> — the GC-managed reference handle.
opcode
Instruction — a single packed bytecode word. C-Lua uses u32.
proto
LuaProto — compiled function prototype. Mirrors C-Lua’s Proto struct but uses Rust idioms (Vec instead of pointer+size pairs).
status
LuaStatus — return codes matching C-Lua’s LUA_OK / LUA_ERR* constants.
string
LuaString — Lua’s byte-string (NOT UTF-8). PORT_STRATEGY §3.3.
table
Lua table implementation (array + hash hybrid).
tagmethod
Metamethod tags — matches C-Lua’s TMS enum ordering.
trace_impls
Phase-D Trace implementations for types defined in this crate.
upval
UpVal — closure upvalues. PORT_STRATEGY §3.8.
userdata
LuaUserData — Lua’s heap-allocated userdata. Carries a typed byte buffer plus optional user values (a Vec of TValues).
value
LuaValue — the tagged-union value type. PORT_STRATEGY §3.2.

Structs§

CallInfoIdx
Index into the call-info stack.
StackIdx
Index into the Lua value stack. Never a pointer or borrow. Stack reallocates; only indices are stable across mutations.

Enums§

LuaType
The base type tag for a Lua value. Matches C-Lua’s LUA_T* constants.