lua

package
v0.0.0-...-e5cea4b Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckString

func CheckString(ls *lua.LState, n int) (string, error)

func CheckType

func CheckType(ls *lua.LState, n int, typ lua.LValueType) error

Types

type LState

type LState struct {
	*lua.LState
}

LState is a wrapper around lua.LState to augment it with our own methods.

func AsLState

func AsLState(ls *lua.LState) *LState

func NewState

func NewState(opts ...lua.Options) *LState

NewState creates and initialize a new LState.

func (*LState) CheckString

func (ls *LState) CheckString(n int) (string, error)

func (*LState) CheckType

func (ls *LState) CheckType(n int, typ lua.LValueType) error

func (*LState) OpenModules

func (ls *LState) OpenModules(modules []Module)

OpenModules loads the specified modules in the current LState. A loaded module is directly usable by the script without having to use a 'require' directive first.

func (*LState) PreloadModules

func (ls *LState) PreloadModules(modules []Module)

PreloadModules preloads the specified modules in the current LState. A preloaded module is made available for inclusion but is not readily available to the script without the use of a 'require' directive first.

func (*LState) PreloadUserModule

func (ls *LState) PreloadUserModule(modules []UserModule) error

type Module

type Module struct {
	Name     string
	Function lua.LGFunction
}

Module is go code that can be called from Lua. It can be either directly opened and made available to the Lus script directly, or just preloaded, in which case it has to be included with a 'require' directive in the script before it can be used.

func StandardLibs

func StandardLibs() []Module

StandardLibs returns the list of standard libraries to load for sandboxed usage.

type UserModule

type UserModule struct {
	Name   string
	Script string
}

UserModule is a Lua sub-script that can be included in the main script through the use of a 'require' directive.

Jump to

Keyboard shortcuts

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