Documentation
¶
Overview ¶
Package api defines the interface for Lua standard library registration.
Each library is a Go function that registers Lua functions into a state. Libraries use the public Go API (internal/api/) to interact with the VM.
Reference: .analysis/09-standard-libraries.md
testlib.go — T (testC) testing library for the Lua 5.5 test suite.
Implements the T global table with T.testC(), T.makeCfunc(), etc. Reference: lua-master/ltests.c
tracegc module — test helper for suppressing/enabling GC finalizer execution.
Provides two functions:
- tracegc.stop() — suppress GC finalizer execution (sets GCStopped = true)
- tracegc.start() — re-enable GC finalizer execution (sets GCStopped = false)
Used by cstack.lua tests to control when finalizers fire. This is a stub that provides just enough for the test suite; C Lua's tracegc is more complex (tracks individual finalizer calls).
Index ¶
- func OpenAll(L *luaapi.State)
- func OpenBase(L *luaapi.State) int
- func OpenCoroutineLib(L *luaapi.State) int
- func OpenDebug(L *luaapi.State) int
- func OpenIO(L *luaapi.State) int
- func OpenLog(L *luaapi.State) int
- func OpenMath(L *luaapi.State) int
- func OpenOS(L *luaapi.State) int
- func OpenPackage(L *luaapi.State) int
- func OpenString(L *luaapi.State) int
- func OpenTable(L *luaapi.State) int
- func OpenTestLib(L *luaapi.State)
- func OpenTraceGC(L *luaapi.State) int
- func OpenUTF8(L *luaapi.State) int
- type Library
- type OpenFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenCoroutineLib ¶
OpenCoroutineLib registers all coroutine library functions. Replaces the stub OpenCoroutine.
func OpenLog ¶ added in v0.9.2
OpenLog registers the "log" module. It is designed to be used as a preloaded module: require("log").
func OpenPackage ¶
OpenPackage opens the "package" library for a Lua state.
func OpenTestLib ¶
func OpenTraceGC ¶
OpenTraceGC is the opener for the "tracegc" module. Returns a table with stop/start functions.
Types ¶
type Library ¶
type Library struct {
Name string // library name (e.g., "string", "table")
Open OpenFunc // opener function
}
Library describes a standard library for registration.
func StandardLibraries ¶
func StandardLibraries() []Library
StandardLibraries returns the list of all standard libraries in load order. Order matters: base must be first (it defines _G and core functions).