lua

package module
v0.0.0-...-86f0125 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: LGPL-3.0 Imports: 8 Imported by: 0

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

View Source
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 New

func New() *Engine

New creates the Lua engine.

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.

func (*Engine) Formats

func (e *Engine) Formats() []string

Formats returns the claimed scriptFormat MIME hints.

func (*Engine) Type

func (e *Engine) Type() string

Type returns the engine kind.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL