Documentation ¶
Index ¶
- type ScriptErrors
- type ScriptSystem
- func (s *ScriptSystem) CallFunc(funcName string, numReturnValues int, returnError bool, args ...lua.LValue) (lua.LValue, error)
- func (s *ScriptSystem) CallFuncSimple(funcName string, args ...lua.LValue) error
- func (s *ScriptSystem) CallFuncWithReturn(funcName string, args ...lua.LValue) (lua.LValue, error)
- func (s *ScriptSystem) DestroyScriptSystem()
- func (s *ScriptSystem) DoFile(fileName string)
- func (s *ScriptSystem) DoFiles(dirName string)
- func (s *ScriptSystem) DoString(code string)
- func (s *ScriptSystem) GetState() *lua.LState
- func (s *ScriptSystem) HasFunc(funcName string) bool
- func (s *ScriptSystem) LoadFile(fileName string) (*lua.LFunction, error)
- func (s *ScriptSystem) LoadFiles(dirName string)
- func (s *ScriptSystem) LoadString(code string) (*lua.LFunction, error)
- func (s *ScriptSystem) NewTable() *lua.LTable
- func (s *ScriptSystem) OnCreate(errOnNotFound bool) error
- func (s *ScriptSystem) OnDestroy(errOnNotFound bool) error
- func (s *ScriptSystem) RegisterFunction(name string, fn lua.LGFunction)
- func (s *ScriptSystem) SetGlobal(name string, value interface{})
- type StdOutScriptErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScriptErrors ¶
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 ¶
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