Documentation ¶
Index ¶
- Variables
- func LoadCheck(lvm *lua.LState) int
- func LuaAssign(obj LuaObject) string
- func LuaAssignLR(left, right LuaObject) string
- func LuaDoFunc(lvm *lua.LState, fun *lua.LFunction) error
- func LuaLabel(name string) string
- func LuaLocalVar(obj LuaObject) string
- func LuaModuleLoader(lvm *lua.LState, funcs LuaFuncs) int
- func NewLuaMCB(fun lua.LGFunction) *luaMCB
- func SafePanic() int
- type ArkExport
- type Handles
- type LuaBooleanObject
- type LuaExport
- type LuaForObject
- type LuaFuncObject
- func (obj *LuaFuncObject) Bind(argv ...LuaObject) *LuaFuncObject
- func (obj *LuaFuncObject) Ident() string
- func (obj *LuaFuncObject) Lambda() *LuaFuncObject
- func (obj *LuaFuncObject) PCall(argv ...LuaObject) string
- func (obj *LuaFuncObject) SetArgc(n int) *LuaFuncObject
- func (obj *LuaFuncObject) SetArgs(args []string) *LuaFuncObject
- func (obj *LuaFuncObject) SetBlock(block ...LuaObject)
- func (obj *LuaFuncObject) Value() string
- type LuaFuncs
- type LuaGotoObject
- type LuaIfObject
- type LuaInterp
- type LuaListObejct
- type LuaMAT
- type LuaMapObject
- type LuaNilObject
- type LuaNumberObject
- type LuaObject
- func LuaComment(comment string) LuaObject
- func LuaDisableFileUndefinedGlobal() LuaObject
- func LuaDisableNextLineUndefinedGlobal() LuaObject
- func LuaGlobalVar(v string) LuaObject
- func LuaIdent(ident string) LuaObject
- func LuaImport(mods ...string) LuaObject
- func LuaPackagePath(paths ...string) LuaObject
- func LuaRequire(modename string) LuaObject
- func LuaSpaceLine() LuaObject
- type LuaProgramObject
- type LuaStringObject
- type LuaTableObject
- func (obj *LuaTableObject) Ident() string
- func (obj *LuaTableObject) Insert(values ...LuaObject) *LuaTableObject
- func (obj *LuaTableObject) InsertKV(k string, v LuaObject) *LuaTableObject
- func (obj *LuaTableObject) SetList(list ...LuaObject) *LuaTableObject
- func (obj *LuaTableObject) SetMap(kvs Luamap) *LuaTableObject
- func (obj *LuaTableObject) Unpack() string
- func (obj *LuaTableObject) Value() string
- type LuaVM
- func (vm *LuaVM) Call(fun string) ([]any, error)
- func (vm *LuaVM) CallByParam(fn string, args []lua.LValue) ([]any, error)
- func (vm *LuaVM) Default() VirtualMachine
- func (vm *LuaVM) Eval(script string) error
- func (vm *LuaVM) EvalFile(fullpath string) error
- func (vm *LuaVM) EvalFunc(fn lua.LValue, args []lua.LValue) ([]any, error)
- func (vm *LuaVM) FastCall(fun string) error
- func (vm *LuaVM) FastCallByParam(fn string, args []lua.LValue) error
- func (vm *LuaVM) FastEvalFunc(fn lua.LValue, args []lua.LValue) error
- func (vm *LuaVM) GetGlobalVar(name string) lua.LValue
- func (vm *LuaVM) Interp() *LuaInterp
- func (vm *LuaVM) LoadModule(name string, loader lua.LGFunction)
- func (vm *LuaVM) RegisterModule(fns LuaFuncs)
- func (vm *LuaVM) SafeSetGlobalFn(loaders LuaFuncs)
- func (vm *LuaVM) SafeSetGlobalVar(name string, v lua.LValue)
- func (vm *LuaVM) SetGlobalFn(loaders LuaFuncs)
- func (vm *LuaVM) SetGlobalVar(name string, v lua.LValue)
- func (vm *LuaVM) UnregisterModule(mid string)
- type Luamap
- type MAT
- type MCB
- type VirtualMachine
Constants ¶
This section is empty.
Variables ¶
var ( LuaNil = NewLuaNil() LuaTrue = LuaBoolean(true) LuaFalse = LuaBoolean(false) )
Functions ¶
func LuaAssignLR ¶
func LuaLocalVar ¶
func NewLuaMCB ¶
func NewLuaMCB(fun lua.LGFunction) *luaMCB
Types ¶
type LuaBooleanObject ¶
type LuaBooleanObject struct {
// contains filtered or unexported fields
}
func LuaBoolean ¶
func LuaBoolean(value bool) *LuaBooleanObject
func NewLuaBooleanObject ¶
func NewLuaBooleanObject(ident string, value bool) *LuaBooleanObject
func (*LuaBooleanObject) Ident ¶
func (obj *LuaBooleanObject) Ident() string
func (*LuaBooleanObject) Value ¶
func (obj *LuaBooleanObject) Value() string
type LuaForObject ¶
type LuaForObject struct {
// contains filtered or unexported fields
}
func LuaIRange ¶
func LuaIRange() *LuaForObject
func LuaKRange ¶
func LuaKRange() *LuaForObject
func (LuaForObject) Ident ¶
func (LuaForObject) Ident() string
func (*LuaForObject) Value ¶
func (obj *LuaForObject) Value() string
type LuaFuncObject ¶
type LuaFuncObject struct {
// contains filtered or unexported fields
}
func LuaFunc ¶
func LuaFunc() *LuaFuncObject
func NewLuaFuncObject ¶
func NewLuaFuncObject(ident string) *LuaFuncObject
func (*LuaFuncObject) Bind ¶
func (obj *LuaFuncObject) Bind(argv ...LuaObject) *LuaFuncObject
func (*LuaFuncObject) Ident ¶
func (obj *LuaFuncObject) Ident() string
func (*LuaFuncObject) Lambda ¶
func (obj *LuaFuncObject) Lambda() *LuaFuncObject
func (*LuaFuncObject) PCall ¶
func (obj *LuaFuncObject) PCall(argv ...LuaObject) string
func (*LuaFuncObject) SetArgc ¶
func (obj *LuaFuncObject) SetArgc(n int) *LuaFuncObject
func (*LuaFuncObject) SetArgs ¶
func (obj *LuaFuncObject) SetArgs(args []string) *LuaFuncObject
func (*LuaFuncObject) SetBlock ¶
func (obj *LuaFuncObject) SetBlock(block ...LuaObject)
func (*LuaFuncObject) Value ¶
func (obj *LuaFuncObject) Value() string
type LuaFuncs ¶
type LuaFuncs map[string]lua.LGFunction
type LuaGotoObject ¶
type LuaGotoObject struct {
// contains filtered or unexported fields
}
func LuaGoto ¶
func LuaGoto(label string) *LuaGotoObject
func (LuaGotoObject) Ident ¶
func (LuaGotoObject) Ident() string
func (*LuaGotoObject) Value ¶
func (obj *LuaGotoObject) Value() string
type LuaIfObject ¶
type LuaIfObject struct {
// contains filtered or unexported fields
}
func LuaIf ¶
func LuaIf(conds []string, block ...LuaObject) *LuaIfObject
func (*LuaIfObject) AppendCond ¶
func (obj *LuaIfObject) AppendCond()
func (LuaIfObject) Ident ¶
func (LuaIfObject) Ident() string
func (*LuaIfObject) SetCond ¶
func (obj *LuaIfObject) SetCond()
func (*LuaIfObject) Value ¶
func (obj *LuaIfObject) Value() string
type LuaListObejct ¶
type LuaListObejct struct {
// contains filtered or unexported fields
}
func LuaList ¶
func LuaList(values ...LuaObject) *LuaListObejct
func NewLuaListObject ¶
func NewLuaListObject(ident string, values ...LuaObject) *LuaListObejct
func (*LuaListObejct) Ident ¶
func (obj *LuaListObejct) Ident() string
func (*LuaListObejct) Insert ¶
func (obj *LuaListObejct) Insert(value ...LuaObject)
func (*LuaListObejct) Unpack ¶
func (obj *LuaListObejct) Unpack() string
func (*LuaListObejct) Value ¶
func (obj *LuaListObejct) Value() string
type LuaMAT ¶
type LuaMAT struct {
// contains filtered or unexported fields
}
MAT is abbreviation for module allocate table, which is used to load module into virtual machine with lazy.
type LuaMapObject ¶
type LuaMapObject struct {
// contains filtered or unexported fields
}
func LuaMap ¶
func LuaMap(values Luamap) *LuaMapObject
func LuaStringMap ¶
func LuaStringMap(values map[string]string) *LuaMapObject
func NewLuaMapObject ¶
func NewLuaMapObject(ident string, values Luamap) *LuaMapObject
func (*LuaMapObject) Ident ¶
func (obj *LuaMapObject) Ident() string
func (*LuaMapObject) Insert ¶
func (obj *LuaMapObject) Insert(k string, v LuaObject) *LuaMapObject
func (*LuaMapObject) Unpack ¶
func (obj *LuaMapObject) Unpack() string
func (*LuaMapObject) Value ¶
func (obj *LuaMapObject) Value() string
type LuaNilObject ¶
type LuaNilObject struct {
// contains filtered or unexported fields
}
func NewLuaNil ¶
func NewLuaNil() *LuaNilObject
func (*LuaNilObject) Ident ¶
func (obj *LuaNilObject) Ident() string
func (LuaNilObject) Value ¶
func (LuaNilObject) Value() string
type LuaNumberObject ¶
type LuaNumberObject struct {
// contains filtered or unexported fields
}
func LuaNumber ¶
func LuaNumber(value string) *LuaNumberObject
func NewLuaNumberObject ¶
func NewLuaNumberObject(ident, value string) *LuaNumberObject
func (*LuaNumberObject) Ident ¶
func (obj *LuaNumberObject) Ident() string
func (*LuaNumberObject) Value ¶
func (obj *LuaNumberObject) Value() string
type LuaObject ¶
LuaObject is an interface to abstract object of lua type
func LuaComment ¶
func LuaDisableFileUndefinedGlobal ¶
func LuaDisableFileUndefinedGlobal() LuaObject
func LuaDisableNextLineUndefinedGlobal ¶
func LuaDisableNextLineUndefinedGlobal() LuaObject
func LuaGlobalVar ¶
func LuaPackagePath ¶
func LuaRequire ¶
func LuaSpaceLine ¶
func LuaSpaceLine() LuaObject
type LuaProgramObject ¶
type LuaProgramObject struct {
// contains filtered or unexported fields
}
func LuaProgram ¶
func LuaProgram(codes ...LuaObject) *LuaProgramObject
func NewLuaProgramObject ¶
func NewLuaProgramObject(ident string, codes ...LuaObject) *LuaProgramObject
func (*LuaProgramObject) Ident ¶
func (obj *LuaProgramObject) Ident() string
func (*LuaProgramObject) Value ¶
func (obj *LuaProgramObject) Value() string
type LuaStringObject ¶
type LuaStringObject struct {
// contains filtered or unexported fields
}
func LuaString ¶
func LuaString(value string) *LuaStringObject
func NewLuaStringObject ¶
func NewLuaStringObject(ident, value string) *LuaStringObject
func (*LuaStringObject) Ident ¶
func (obj *LuaStringObject) Ident() string
func (*LuaStringObject) Value ¶
func (obj *LuaStringObject) Value() string
type LuaTableObject ¶
type LuaTableObject struct {
// contains filtered or unexported fields
}
func LuaTable ¶
func LuaTable() *LuaTableObject
func NewLuaTabelObject ¶
func NewLuaTabelObject(ident string) *LuaTableObject
func (*LuaTableObject) Ident ¶
func (obj *LuaTableObject) Ident() string
func (*LuaTableObject) Insert ¶
func (obj *LuaTableObject) Insert(values ...LuaObject) *LuaTableObject
func (*LuaTableObject) InsertKV ¶
func (obj *LuaTableObject) InsertKV(k string, v LuaObject) *LuaTableObject
func (*LuaTableObject) SetList ¶
func (obj *LuaTableObject) SetList(list ...LuaObject) *LuaTableObject
func (*LuaTableObject) SetMap ¶
func (obj *LuaTableObject) SetMap(kvs Luamap) *LuaTableObject
func (*LuaTableObject) Unpack ¶
func (obj *LuaTableObject) Unpack() string
func (*LuaTableObject) Value ¶
func (obj *LuaTableObject) Value() string
type LuaVM ¶
type LuaVM struct {
// contains filtered or unexported fields
}
func (*LuaVM) CallByParam ¶
Call to call specify function with arguments
func (*LuaVM) FastCallByParam ¶
FastCallByParam to call specify function with arguments and not return value
func (*LuaVM) FastEvalFunc ¶
FastEvalFunc to execute function and not return value
func (*LuaVM) GetGlobalVar ¶
GetGlobalVar returns global variable
func (*LuaVM) LoadModule ¶
func (vm *LuaVM) LoadModule(name string, loader lua.LGFunction)
LoadModule to immediately load module to be specified
func (*LuaVM) RegisterModule ¶
RegisterModule to register modules
func (*LuaVM) SafeSetGlobalFn ¶
SafeSetGlobalFn to set global function when it isn't exist
func (*LuaVM) SafeSetGlobalVar ¶
SafeSetGlobalVar to set global variable when variable isn't exist
func (*LuaVM) SetGlobalFn ¶
SetGlobalFn to set global function
func (*LuaVM) SetGlobalVar ¶
SetGlobalVar to set global variable
func (*LuaVM) UnregisterModule ¶
UnregisterModule to unregister specify module
type MAT ¶
type MAT interface { // Mount to add MCB to MAT Mount(LuaFuncs) MAT // Unmount to remove MCB from MAT Unmount(string) MAT // Collect to converge specify mcb according to cluster. Collect(string, []string) MAT // MCB returns mcb list MCB(string) map[string]*luaMCB }
MAT is abbreviation for module allocate table, which is used to load module into virtual machine with lazy.
type MCB ¶
type MCB interface { // Mark to set module used state Mark() // Used returns whether mcb is used Used() bool }
MCB is abbreviation for module control block, which store and control module meta.
type VirtualMachine ¶
type VirtualMachine interface { // Default to build vm with standard Default() VirtualMachine // Call to call specify function without arguments Call(string) ([]any, error) // FastCall to call specify function without arguments and not return value FastCall(string) error // Call to call specify function with arguments CallByParam(string, []lua.LValue) ([]any, error) // FastCallByParam to call specify function with arguments and not return value FastCallByParam(string, []lua.LValue) error // Eval to execute string of script Eval(string) error // EvalFile to execute file of script EvalFile(string) error // EvalFunc to execute function EvalFunc(lua.LValue, []lua.LValue) ([]any, error) // FastEvalFunc to execute function and not return value FastEvalFunc(lua.LValue, []lua.LValue) error // SetGlobalFn to set global function SetGlobalFn(Handles) // SafeSetGlobalFn to set global function when it isn't exist SafeSetGlobalFn(Handles) // GetGlobalVar returns global variable GetGlobalVar(string) lua.LValue // SetGlobalVar to set global variable SetGlobalVar(string, lua.LValue) // SafeSetGlobalVar to set global variable when variable isn't exist SafeSetGlobalVar(string, lua.LValue) // RegisterModule to register modules RegisterModule(Handles) // UnregisterModule to unregister specify module UnregisterModule(string) // LoadModule to immediately load module to be specified LoadModule(string, lua.LGFunction) // Interp returns interpreter Interp() *LuaInterp }
VirtualMachine is an interface to abstract different interpreter
func NewVirtualMachine ¶
func NewVirtualMachine() VirtualMachine