lua

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package lua exposes hex/config to Lua scripts as the "config" module.

local config = require("config")

local port = config.string("server.address")
local n    = config.int("db.pool.max_open")
local dbg  = config.bool("app.debug")
local t    = config.duration("http.timeout")   -- returns seconds (number)
local xs   = config.stringSlice("app.mirrors")

config.set("app.name", "reset from REPL")     -- runtime override
local exists = config.has("some.key")

for _, ns in ipairs(config.namespaces()) do
    print(ns)
end

The `duration` helper returns the value as seconds (Lua number). Convert to milliseconds by multiplying by 1000 if needed.

Errors return (nil, "message"). config.set surfaces validation failures against the CUE schema when applicable.

Index

Constants

This section is empty.

Variables

View Source
var TypeStub string

TypeStub is the Teal .d.tl source describing the `config` module.

Functions

This section is empty.

Types

type Bindings

type Bindings struct {
	// Store is the config store to read/write. Required.
	Store *config.Store
}

Bindings configures the 'config' module.

func (*Bindings) Loader

func (b *Bindings) Loader(L *glua.LState) int

Loader is the gopher-lua LGFunction registered against env.PreloadModule("config", b.Loader).

Jump to

Keyboard shortcuts

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