goscriptsystem

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScriptErrors

type ScriptErrors interface {
	Enable()
	Disable()
	IsEnabled() bool
	HandleError(err ...any)
}

type ScriptSystem

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

ScriptSystem use Lua for scripting.

func New

func New(errors ScriptErrors) *ScriptSystem

NewScriptSystem Initializes the Lua Script System

func (*ScriptSystem) CallFunc

func (s *ScriptSystem) CallFunc(funcName string, numReturnValues int, returnError bool, args ...lua.LValue) (lua.LValue, error)

CallFunc Call a Lua function

func (*ScriptSystem) CallFuncSimple

func (s *ScriptSystem) CallFuncSimple(funcName string, args ...lua.LValue) error

CallFuncSimple This is just sugar for calling a Lua function without having to deal with additional parameters.

func (*ScriptSystem) CallFuncWithReturn

func (s *ScriptSystem) CallFuncWithReturn(funcName string, args ...lua.LValue) (lua.LValue, error)

CallFuncWithReturn Call a Lua function that has one return value

func (*ScriptSystem) DestroyScriptSystem

func (s *ScriptSystem) DestroyScriptSystem()

DestroyScriptSystem Calls lua.LState.Close

func (*ScriptSystem) DoFile

func (s *ScriptSystem) DoFile(fileName string)

DoFile Load the file and run its code

func (*ScriptSystem) DoFiles

func (s *ScriptSystem) DoFiles(dirName string)

DoFiles Loads and processes files from the list generated by os.ReadDir

func (*ScriptSystem) DoString

func (s *ScriptSystem) DoString(code string)

DoString Run the passed code string

func (*ScriptSystem) GetState

func (s *ScriptSystem) GetState() *lua.LState

func (*ScriptSystem) HasFunc

func (s *ScriptSystem) HasFunc(funcName string) bool

func (*ScriptSystem) LoadFile

func (s *ScriptSystem) LoadFile(fileName string) (*lua.LFunction, error)

LoadFile Load the file

func (*ScriptSystem) LoadFiles

func (s *ScriptSystem) LoadFiles(dirName string)

LoadFiles Loads files from the list generated by os.ReadDir

func (*ScriptSystem) LoadString

func (s *ScriptSystem) LoadString(code string) (*lua.LFunction, error)

LoadString load the passed code string

func (*ScriptSystem) NewTable

func (s *ScriptSystem) NewTable() *lua.LTable

NewTable Creates a new table

func (*ScriptSystem) OnCreate

func (s *ScriptSystem) OnCreate(errOnNotFound bool) error

func (*ScriptSystem) OnDestroy

func (s *ScriptSystem) OnDestroy(errOnNotFound bool) error

func (*ScriptSystem) RegisterFunction

func (s *ScriptSystem) RegisterFunction(name string, fn lua.LGFunction)

RegisterFunction Register a function. This is here for convenience. SetGlobal is more flexible and should be preferred

func (*ScriptSystem) SetGlobal

func (s *ScriptSystem) SetGlobal(name string, value interface{})

SetGlobal Just like the Lua version.

type StdOutScriptErrors

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

StdOutScriptErrors handler

func NewStdOutScriptErrors

func NewStdOutScriptErrors() *StdOutScriptErrors

NewScriptErrors Creates a new StdOutScriptErrors object

func (*StdOutScriptErrors) Disable

func (s *StdOutScriptErrors) Disable()

Disable Disables debug output.

func (*StdOutScriptErrors) Enable

func (s *StdOutScriptErrors) Enable()

Enable Enables debug output.

func (*StdOutScriptErrors) HandleError

func (s *StdOutScriptErrors) HandleError(err ...any)

func (*StdOutScriptErrors) IsEnabled

func (s *StdOutScriptErrors) IsEnabled() bool

IsEnabled True if Debug Mode is enabled false otherwise

Jump to

Keyboard shortcuts

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