Skip to main content

Module base

Module base 

Source
Expand description

Base library — Lua’s built-in functions (print, type, pairs, pcall, …), covering Lua 5.1–5.5 from one source.

C source: reference/lua-5.4.7/src/lbaselib.c.

GRADUATED (Phase-2 idiomatization, 2026-06-14, idiom/base). base is the most VM-adjacent stdlib module: pcall/xpcall/error drive unwinding, load compiles, next/pairs/ipairs iterate, type/tostring/raw* are hot. All of that plumbing is load-bearing and was idiomatized AROUND, never through — the only edits are in the cold arg-checking / result-shaping / version-dispatch / registration layers. The behavioral net that now guards it: tests/base_strengthen.rs (reference-pinned across all five versions), multiversion_oracle, the official calls/errors/ nextvar/constructs suites, and check.sh ×5. Net-strengthening FIRST caught three cross-version bugs the weak net hid — ipairs (raw read + table-check + __ipairs on 5.1/5.2), assert (5.1/5.2 string-coercible message), rawlen (function-named, version-gated reject) — all fixed in the cold seam layer. Two bugs needing VM-internal changes were reported, not forced: __name honored pre-5.3 (lives in obj_type_name_cow) and the 5.1/5.2 '?'/'_G.' arg-error function-name resolution.

Functions§

open
Open the base library: register all base functions into the global table, then set _G (a self-reference) and _VERSION.