lua

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

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

local queue = require("queue")

local id, err = queue.publish("send_email", '{"to":"a@b.c"}')

v1 is publish-only. Subscribing from Lua ("queue.subscribe(topic, function(msg) ... end)") is a follow-up: bridging a long-running Go goroutine to a Lua callback needs LState serialisation (LStates are not thread-safe), which the REPL and scripting use cases don't need yet. Go-side subscribers see Lua-published messages immediately.

Message bodies are strings on the Lua side; hex/queue stores raw []byte. Structured payloads should be JSON-encoded before publish — a gopher-json module is on the follow-up list.

Index

Constants

This section is empty.

Variables

View Source
var TypeStub string

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

Functions

This section is empty.

Types

type Bindings

type Bindings struct {
	// Queue is the backend to publish against. Required.
	Queue queue.Queue

	// Context, when non-nil, is used for every publish. Defaults
	// to context.Background().
	Context context.Context
}

Bindings configures the 'queue' module.

func (*Bindings) Loader

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

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

Jump to

Keyboard shortcuts

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