Documentation
¶
Overview ¶
Package lua is the batteries Script Engine (ADR-031 §2.4): Lua via the pure-Go gopher-lua VM — no cgo, static builds intact. Each execution runs on a fresh, context-bound, sandboxed LState (base/table/string/math only; the load family removed; io/os never loaded; print is the one recorded stdout side-channel).
Scripts read process data lazily through the read-only `data` global — an absent datum RAISES naming it (the fail-loud house rule over Lua's nil idiom; probe optional data with `has(name)`) — and produce outputs by returning a table of named values. Lua numbers land as float64 (the language's single number type).
Index ¶
Constants ¶
const (
// LuaType is the engine kind (the "##"-hint convention).
LuaType = "##Lua"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct{}
Engine is the Lua script.Engine. It is stateless — every Execute builds its own sandboxed LState — so one Engine serves concurrent tracks.
func (*Engine) Execute ¶
func (e *Engine) Execute( ctx context.Context, format, body string, r service.DataReader, ) (script.Outputs, error)
Execute runs body on a fresh sandboxed LState bound to ctx and returns the script's named outputs (the returned table). A missing datum, an unmappable value, a non-table return and any Lua error fail loud.