plugin

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MPL-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewState added in v0.9.12

func NewState(callStackSize int, registrySize int) *lua.LState

NewState prepares a new Lua environment

Types

type Config

type Config struct {
	Path          string
	CallStackSize int
	RegistrySize  int
}

Config stores the configuration of a single plugin

type Globals

type Globals map[string]interface{}

Globals stores shared variables

type Plugin

type Plugin struct {
	*lua.LState

	// Set once before Run(), read-only after that
	*Config
	// contains filtered or unexported fields
}

Plugin loads and executes a lua script

func Load

func Load(conf *Config) (*Plugin, error)

Load a lua plugin

func (*Plugin) Close added in v0.9.12

func (p *Plugin) Close()

Close plugin

func (*Plugin) Run added in v0.10.0

func (p *Plugin) Run() error

Run plugin

func (*Plugin) SetGlobal

func (p *Plugin) SetGlobal(name string, val interface{})

SetGlobal variable

type Timers added in v0.9.12

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

Timers registers all active timers

func (*Timers) AfterFunc added in v0.9.12

func (t *Timers) AfterFunc(ms int, f func()) func() bool

AfterFunc waits for the duration to elapse and then calls f in its own goroutine see time.AfterFunc

func (*Timers) ImportTo added in v0.9.12

func (t *Timers) ImportTo(ls *lua.LState)

ImportTo Lua state

func (*Timers) Stop added in v0.9.12

func (t *Timers) Stop()

Stop all timers

Jump to

Keyboard shortcuts

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