Help us shape the future of Go! Take the 2026 Go Developer Survey

lua

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	L *lua.LState
	// contains filtered or unexported fields
}

Instance represents a single Lua VM.

func (*Instance) Close

func (i *Instance) Close()

Close shuts down the Lua state and unregisters it from the manager.

func (*Instance) RunFile

func (i *Instance) RunFile(path string) error

RunFile executes a Lua script file.

func (*Instance) RunString

func (i *Instance) RunString(code string) error

RunString executes Lua code in the instance.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager coordinates multiple sandboxed Lua states.

func NewManager

func NewManager(logger *log.Loggee) *Manager

NewManager creates a manager with an optional logger. When logger is nil, scripting logs are dropped.

func (*Manager) Close

func (m *Manager) Close()

Close stops all instances managed by this manager.

func (*Manager) NewInstance

func (m *Manager) NewInstance(name string) (*Instance, error)

NewInstance creates a new Lua state with a sandboxed environment.

func (*Manager) RegisterFunction

func (m *Manager) RegisterFunction(name string, fn lua.LGFunction)

RegisterFunction exposes a Go function to all Lua states managed by this manager.

func (*Manager) SetDefaultSender

func (m *Manager) SetDefaultSender(sender string)

SetDefaultSender overrides the sender name used when logging from scripts.

Source Files

  • manager.go

Jump to

Keyboard shortcuts

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