Documentation ¶
Index ¶
- func LuaDoFunc(lvm *lua.LState, fun *lua.LFunction) error
- func New(opts ...YockrOption) yocki.YockRuntime
- func UpgradeInterpPool(yockr yocki.YockRuntime) yocki.YockRuntime
- func UpgradeTable(tbl *lua.LTable) yocki.Table
- type Table
- func (t *Table) Bind(v any) error
- func (tbl *Table) Clone(l *lua.LState) yocki.Table
- func (t *Table) GetBool(key string) (bool, bool)
- func (t *Table) GetFloat(key string) (float64, bool)
- func (t *Table) GetInt(key string) (int, bool)
- func (t *Table) GetLTable(key string) (*lua.LTable, bool)
- func (t *Table) GetString(key string) (string, bool)
- func (t *Table) GetTable(key string) (yocki.Table, bool)
- func (t *Table) MustGetTable(key string) yocki.Table
- func (t *Table) SetBool(k string, v bool)
- func (t *Table) SetDo(k string, v func(yocki.YockState) lua.LValue, env ...yocki.YockState)
- func (t *Table) SetField(l *lua.LState, k string, v any)
- func (t *Table) SetFields(l *lua.LState, v map[string]any)
- func (t *Table) SetInt(k string, v int)
- func (t *Table) SetLTable(k string, v *lua.LTable)
- func (t *Table) SetNil(k string)
- func (t *Table) SetString(k, v string)
- func (t *Table) SetTable(k string, v yocki.Table)
- func (t *Table) ToFloat32(n int) float32
- func (t *Table) ToFloat32ByString(k string) float32
- func (t *Table) ToFloat64(n int) float64
- func (t *Table) ToFloat64ByString(k string) float64
- func (t *Table) ToFunction(n int) *lua.LFunction
- func (t *Table) ToFunctionByString(k string) *lua.LFunction
- func (t *Table) ToInt(n int) int
- func (t *Table) ToIntByString(k string) int
- func (t *Table) ToString(n int) string
- func (t *Table) ToTable(n int) yocki.Table
- func (tbl *Table) Value() *lua.LTable
- type YockInterp
- func (yockr *YockInterp) Call(fun string) ([]lua.LValue, error)
- func (yockr *YockInterp) Eval(script string) error
- func (yockr *YockInterp) EvalFile(fullpath string) error
- func (yockr *YockInterp) EvalFunc(fn lua.LValue, args []lua.LValue) ([]lua.LValue, error)
- func (yockr *YockInterp) FastCall(fun string) error
- func (yockr *YockInterp) FastEvalFunc(fn lua.LValue, args []lua.LValue) error
- func (yockr *YockInterp) GetGlobalVar(name string) lua.LValue
- func (yockr *YockInterp) NewState() (yocki.YockState, context.CancelFunc)
- func (yockr *YockInterp) SafeSetGlobalFn(loaders map[string]lua.LGFunction)
- func (yockr *YockInterp) SafeSetGlobalVar(name string, v lua.LValue)
- func (yockr *YockInterp) SetGlobalFn(loaders map[string]lua.LGFunction)
- func (yockr *YockInterp) SetGlobalVar(name string, v lua.LValue)
- func (yockr *YockInterp) SetState(l yocki.YockState)
- func (yockr *YockInterp) State() yocki.YockState
- type YockInterpPool
- func (yockr *YockInterpPool) Call(name string) ([]lua.LValue, error)
- func (yockr *YockInterpPool) Eval(string) error
- func (yockr *YockInterpPool) EvalFile(string) error
- func (yockr *YockInterpPool) EvalFunc(lua.LValue, []lua.LValue) ([]lua.LValue, error)
- func (yockr *YockInterpPool) FastCall(string) error
- func (yockr *YockInterpPool) FastEvalFunc(lua.LValue, []lua.LValue) error
- func (yockr *YockInterpPool) Get() yocki.YockRuntime
- func (yockr *YockInterpPool) GetGlobalVar(string) lua.LValue
- func (yockr *YockInterpPool) New() yocki.YockRuntime
- func (yockr *YockInterpPool) NewState() (yocki.YockState, context.CancelFunc)
- func (yockr *YockInterpPool) Put(interp yocki.YockRuntime) error
- func (yockr *YockInterpPool) SafeSetGlobalFn(map[string]lua.LGFunction)
- func (yockr *YockInterpPool) SafeSetGlobalVar(string, lua.LValue)
- func (yockr *YockInterpPool) SetGlobalFn(map[string]lua.LGFunction)
- func (yockr *YockInterpPool) SetGlobalVar(string, lua.LValue)
- func (yockr *YockInterpPool) SetState(l yocki.YockState)
- func (yockr *YockInterpPool) State() yocki.YockState
- type YockLib
- func (lib *YockLib) Meta() yocki.Table
- func (lib *YockLib) Name() string
- func (lib *YockLib) SetClosure(v map[string]lua.LGFunction)
- func (lib *YockLib) SetField(v map[string]any)
- func (lib *YockLib) SetFunction(name string, fn lua.LGFunction)
- func (lib *YockLib) SetFunctions(v map[string]lua.LGFunction)
- func (lib *YockLib) SetState(s yocki.YockState)
- func (lib *YockLib) SetTable(t yocki.Table)
- func (lib *YockLib) SetYFunction(v map[string]yocki.YGFunction)
- func (lib *YockLib) State() yocki.YockState
- func (lib *YockLib) Value() lua.LValue
- type YockState
- func (s *YockState) Argc() int
- func (s *YockState) Call(info yocki.YockFuncInfo, args ...any) error
- func (s *YockState) CheckAny(n int) any
- func (s *YockState) CheckBool(n int) bool
- func (s *YockState) CheckFunction(n int) *lua.LFunction
- func (s *YockState) CheckInt(n int) int
- func (s *YockState) CheckLTable(n int) *lua.LTable
- func (s *YockState) CheckLValue(n int) lua.LValue
- func (s *YockState) CheckNumber(n int) lua.LNumber
- func (s *YockState) CheckRune(n int) rune
- func (s *YockState) CheckString(n int) string
- func (s *YockState) CheckTable(n int) yocki.Table
- func (s *YockState) Clone() yocki.YockState
- func (s *YockState) Exit() int
- func (s *YockState) IsBool(n int) bool
- func (s *YockState) IsChannel(n int) bool
- func (s *YockState) IsFunction(n int) bool
- func (s *YockState) IsNil(n int) bool
- func (s *YockState) IsNumber(n int) bool
- func (s *YockState) IsString(n int) bool
- func (s *YockState) IsTable(n int) bool
- func (s *YockState) IsThread(n int) bool
- func (s *YockState) IsUserData(n int) bool
- func (s *YockState) LState() *lua.LState
- func (s *YockState) NewLFunction(f lua.LGFunction) *lua.LFunction
- func (s *YockState) NewYFunction(f yocki.YGFunction) *lua.LFunction
- func (s *YockState) PCall() error
- func (s *YockState) PopAll()
- func (s *YockState) Push(v lua.LValue) yocki.YockState
- func (s *YockState) PushAll(vals ...any) yocki.YockState
- func (s *YockState) PushBool(b bool) yocki.YockState
- func (s *YockState) PushError(err error) yocki.YockState
- func (s *YockState) PushInt(i int) yocki.YockState
- func (s *YockState) PushNil() yocki.YockState
- func (s *YockState) PushNilTable() yocki.YockState
- func (s *YockState) PushString(str string) yocki.YockState
- func (s *YockState) Pusha(val any) yocki.YockState
- func (s *YockState) Stack(i int) (dbg *lua.Debug, ok bool)
- func (s *YockState) Stacktrace() string
- func (s *YockState) Throw(err error) yocki.YockState
- type YockrOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...YockrOption) yocki.YockRuntime
New initialize yock runtime and returns the its pointer
func UpgradeInterpPool ¶
func UpgradeInterpPool(yockr yocki.YockRuntime) yocki.YockRuntime
Types ¶
type Table ¶
func (*Table) ToFloat32ByString ¶
func (*Table) ToFloat64ByString ¶
func (*Table) ToIntByString ¶
type YockInterp ¶
type YockInterp struct {
// contains filtered or unexported fields
}
YockInterp abstracts lua interpreter
func (*YockInterp) Call ¶
func (yockr *YockInterp) Call(fun string) ([]lua.LValue, error)
Call to call specify function without arguments
func (*YockInterp) Eval ¶
func (yockr *YockInterp) Eval(script string) error
Eval to execute string of script
func (*YockInterp) EvalFile ¶
func (yockr *YockInterp) EvalFile(fullpath string) error
EvalFile to execute file of script
func (*YockInterp) FastCall ¶
func (yockr *YockInterp) FastCall(fun string) error
FastCall to call specify function without arguments and not return value
func (*YockInterp) FastEvalFunc ¶
FastEvalFunc to execute function and not return value
func (*YockInterp) GetGlobalVar ¶
func (yockr *YockInterp) GetGlobalVar(name string) lua.LValue
GetGlobalVar returns global variable
func (*YockInterp) NewState ¶
func (yockr *YockInterp) NewState() (yocki.YockState, context.CancelFunc)
func (*YockInterp) SafeSetGlobalFn ¶
func (yockr *YockInterp) SafeSetGlobalFn(loaders map[string]lua.LGFunction)
SafeSetGlobalFn to set global function when it isn't exist
func (*YockInterp) SafeSetGlobalVar ¶
func (yockr *YockInterp) SafeSetGlobalVar(name string, v lua.LValue)
SafeSetGlobalVar to set global variable when variable isn't exist
func (*YockInterp) SetGlobalFn ¶
func (yockr *YockInterp) SetGlobalFn(loaders map[string]lua.LGFunction)
SetGlobalFn to set global function
func (*YockInterp) SetGlobalVar ¶
func (yockr *YockInterp) SetGlobalVar(name string, v lua.LValue)
SetGlobalVar to set global variable
func (*YockInterp) SetState ¶
func (yockr *YockInterp) SetState(l yocki.YockState)
type YockInterpPool ¶
type YockInterpPool struct {
// contains filtered or unexported fields
}
func (*YockInterpPool) Call ¶
func (yockr *YockInterpPool) Call(name string) ([]lua.LValue, error)
Call to call specify function without arguments
func (*YockInterpPool) Eval ¶
func (yockr *YockInterpPool) Eval(string) error
func (*YockInterpPool) EvalFile ¶
func (yockr *YockInterpPool) EvalFile(string) error
EvalFile to execute file of script
func (*YockInterpPool) FastCall ¶
func (yockr *YockInterpPool) FastCall(string) error
FastCall to call specify function without arguments and not return value
func (*YockInterpPool) FastEvalFunc ¶
FastEvalFunc to execute function and not return value
func (*YockInterpPool) Get ¶
func (yockr *YockInterpPool) Get() yocki.YockRuntime
func (*YockInterpPool) GetGlobalVar ¶
func (yockr *YockInterpPool) GetGlobalVar(string) lua.LValue
GetGlobalVar returns global variable
func (*YockInterpPool) New ¶
func (yockr *YockInterpPool) New() yocki.YockRuntime
func (*YockInterpPool) NewState ¶
func (yockr *YockInterpPool) NewState() (yocki.YockState, context.CancelFunc)
func (*YockInterpPool) Put ¶
func (yockr *YockInterpPool) Put(interp yocki.YockRuntime) error
func (*YockInterpPool) SafeSetGlobalFn ¶
func (yockr *YockInterpPool) SafeSetGlobalFn(map[string]lua.LGFunction)
SafeSetGlobalFn to set global function when it isn't exist
func (*YockInterpPool) SafeSetGlobalVar ¶
func (yockr *YockInterpPool) SafeSetGlobalVar(string, lua.LValue)
SafeSetGlobalVar to set global variable when variable isn't exist
func (*YockInterpPool) SetGlobalFn ¶
func (yockr *YockInterpPool) SetGlobalFn(map[string]lua.LGFunction)
SetGlobalFn to set global function
func (*YockInterpPool) SetGlobalVar ¶
func (yockr *YockInterpPool) SetGlobalVar(string, lua.LValue)
SetGlobalVar to set global variable
func (*YockInterpPool) SetState ¶
func (yockr *YockInterpPool) SetState(l yocki.YockState)
func (*YockInterpPool) State ¶
func (yockr *YockInterpPool) State() yocki.YockState
RegisterModule to register modules RegisterModule(map[string]lua.LGFunction) UnregisterModule to unregister specify module UnregisterModule(string) LoadModule to immediately load module to be specified LoadModule(string, lua.LGFunction) State returns LState
type YockLib ¶
type YockLib struct {
// contains filtered or unexported fields
}
func CreateYockLib ¶
CreateYockLib returns new library whether it exist or not.
func OpenYockLib ¶
OpenYockLib returns existed library based on name and creates new library when lib isn't exist.
func (*YockLib) SetClosure ¶
func (lib *YockLib) SetClosure(v map[string]lua.LGFunction)
func (*YockLib) SetFunction ¶
func (lib *YockLib) SetFunction(name string, fn lua.LGFunction)
func (*YockLib) SetFunctions ¶
func (lib *YockLib) SetFunctions(v map[string]lua.LGFunction)
func (*YockLib) SetYFunction ¶
func (lib *YockLib) SetYFunction(v map[string]yocki.YGFunction)
type YockState ¶
type YockState struct {
// contains filtered or unexported fields
}
func UpgradeLState ¶
func (*YockState) CheckString ¶
func (*YockState) IsFunction ¶
func (*YockState) IsUserData ¶
func (*YockState) NewLFunction ¶
func (s *YockState) NewLFunction(f lua.LGFunction) *lua.LFunction
func (*YockState) NewYFunction ¶
func (s *YockState) NewYFunction(f yocki.YGFunction) *lua.LFunction
func (*YockState) PushError ¶
PushError returns the appropriate value depending on whether the error exists or not. Exists, returns error's text information, otherwise returns null.
@return string|nil
func (*YockState) PushNilTable ¶
func (*YockState) Stacktrace ¶
stacktrace returns the stack info of function, in form of file:line
type YockrOption ¶
type YockrOption func(yockr yocki.YockRuntime) error
func OptionEnableInterpPool ¶
func OptionEnableInterpPool() YockrOption
func OptionLState ¶
func OptionLState(opt lua.Options) YockrOption