1.7 KiB
1.7 KiB
Lua agent guide
Lua 5.1 (LuaJIT dialect) written entirely in Ziran: lexer/parser, compiler to
register bytecode, interpreter, mark-and-sweep collector with weak tables and
__gc, and the standard libraries. No C code, no native libraries. Built for
Katalis to run Luanti mods from ContentDB. Embedding follows the Lua C API:
a stack, natives as plain Ziran procedures, userdata with metatables,
registry references, yieldable coroutines, and memory/call-depth/instruction
limits for untrusted mods. File and environment access is off until the host
grants it.
Layout
src/vm.zi— the module, exported asvm; importlua/vm.tests/—vm_test.zi,conformance_test.zi,katalis_mods_test.zi, and the wasm entry.docs/— extra documentation.Makefile—testrunsunit conformance katalis wasm;build/holds outputs; an ignoredziran.local.tomldrops--locked.
Commands
make unit/make conformance/make katalis— build each suite with--target=cand run it with display variables removed.make wasm— Ziran emits C for wasm32,EMCC(emsdk) compiles it, and a private headless Chromium (fresh profile underbuild/, shortTMPDIR) runs it; needsEMCCandCHROMIUMavailable.make test— all four suites.
Pins
- Toolchain:
ziran.lockpins ziran.git5db3d3c39425d5dfe4bfe4a84e6f6e2e5a810ad0. - Consumers:
ziran add https://git.waozi.xyz/ziranlang/lua.git.
Question -> file
- Embedding API and limits? -> README,
src/vm.zi. - What is tested? ->
tests/and theMakefiletargets. - How does the wasm run work? ->
Makefile(wasmtarget comments). - Which toolchain? ->
ziran.toml,ziran.lock.