Expand description
Rust-native translation of lapi.c — the Lua C-API surface.
The C-API surface (lua_State *, int stack-index protocol) is replaced by
methods on LuaState. lua_lock/lua_unlock are dropped (no-op in the
single-threaded default build). api_incr_top is dropped; state.push()
already increments. Stack pointers (StkId) become StackIdx (u32).
Enums§
Constants§
Functions§
- abs_
index - arith
- at_
panic - call_k
- check_
stack - close_
slot - C’s
lua_closeslot: this clears the slot atidx(sets it to nil), but does not invoke the value’s__closemetamethod — a destructive but incomplete stand-in. The host-side to-be-closed path is not wired into the VM’s TBC machinery (issue #278); scripts still get full<close>semantics viaOP_TBC. - compare
- concat
- configure_
startup_ gc_ mode - Configure the hosted-runtime GC mode after the standard libraries are open.
- copy
- C’s
lua_copy: copy the value atfromidxintotoidx(a stack slot or a function-upvalue pseudo-index). Copying toLUA_REGISTRYINDEXis intentionally a no-op — C would replace the wholel_registrytable, a footgun no real embedder uses (issue #278). - create_
table - dump
- gc
- get_
field - get_
global - get_i
- get_
i_ uservalue - get_
i_ value - Variant of
get_ithat accepts a pre-resolved table value instead of a stack index. Callers that invokeget_irepeatedly on the same table (e.g. the shift loops intable.remove/table.insert) should resolve the table once and use this function to avoid callingindex_to_valueon every iteration. - get_
metatable - get_
table - get_top
- get_
upvalue - is_
cfunction - is_
integer - is_
number - is_
string - is_
userdata - len
- load
- lua_
error - lua_
type_ at - new_
userdata_ uv - next
- pcall_k
- positive_
index_ value - Fast path for ordinary positive stack indices.
- push_
boolean - push_
cclosure - C’s
lua_pushcclosure: registerf, then push either a light C function (n == 0) or a C closure that captures the topnstack values as upvalues. - push_
fstring - push_
integer - push_
light_ userdata - push_
lstring - push_
nil - push_
number - push_
string - push_
thread - push_
value - push_
vfstring - raw_
equal - raw_get
- raw_
get_ i - raw_
get_ p - raw_len
- raw_set
- raw_
set_ i - raw_
set_ p - rotate
- run_
close_ finalizers - Run every still-pending
__gcfinalizer at state close. - run_
pending_ finalizers - Drain objects already promoted from
pending_finalizerstoto_be_finalizedby the heap mark phase. - run_
pending_ finalizers_ inner __gcdriver that mirrors C-Lua’sGCTM(L, propagateerrors).- scan_
v51_ finalizable_ userdata - Lua 5.1 collect-time finalizability scan, run before an explicit collect.
- set_
field - set_
global - set_i
- set_
i_ uservalue - set_
i_ value - Variant of
set_ithat accepts a pre-resolved table value instead of a stack index. Callers that invokeset_irepeatedly on the same table (e.g. the shift loops intable.remove/table.insert) should resolve the table once and use this function to avoid callingindex_to_valueon every iteration. - set_
metatable - set_
table - set_top
- set_
warn_ f - setup_
value - status
- string_
to_ number - to_
boolean - to_
cfunction - C’s
lua_tocfunction: the underlying bare C function pointer for a light C function or a C closure, orNonefor any other value.LightC/LuaCClosurestore aLuaCFnPtrindex into the per-statec_functionstable; resolve it and hand back the registeredfn. - to_
close - C’s
lua_toclose: mark the value atidxas a to-be-closed slot. Host-only stub — scripts get<close>semantics through the VM’sOP_TBCpath, which is not routed through this C-API surface, so this only validates the index and does nothing else. Seedocs/EMBEDDING_API_IMPLEMENTATION.md“Known Limits” (issue #278). - to_
integer_ x - to_
lua_ string - to_
number_ x - to_
pointer - C’s
lua_topointerkeyed on a stack index. Returns ausizeidentity token (raw void* pointers are confined to lua-gc / lua-coro). Delegates to the singlevalue_identity_pointerresolver. - to_
thread - to_
userdata - type_
name - upvalue_
id - upvalue_
join - value_
identity_ pointer - The object-identity token for a
LuaValue, mirroringlua_topointer. Reference types (string, table, function, userdata, thread, light userdata) yieldSome; the value types (nil, boolean, numbers) yieldNone. - version
- warning
- xmove
- Move the top
nvalues fromfrom’s stack ontoto’s stack.