Documentation
¶
Overview ¶
GopherLua: VM and compiler for Lua in Go
Index ¶
- Constants
- Variables
- func B2S(b []byte) string
- func CheckBool(L *LState, lv LValue) bool
- func CheckInt(L *LState, lv LValue) int
- func CheckInt64(L *LState, lv LValue) int64
- func CheckIntOrDefault(L *LState, lv LValue, d int) int
- func CheckSocket(v string) error
- func CheckString(L *LState, lv LValue) string
- func FileSuffix(path string) string
- func HijackTable(fsm *CallFrameFSM) bool
- func IsChar(ch byte) bool
- func IsFalse(v LValue) bool
- func IsInt(v LValue) int
- func IsIntChar(ch byte) bool
- func IsNull(v []byte) bool
- func IsString(v LValue) string
- func IsTrue(v LValue) bool
- func L2SS(L *LState) []string
- func LVAsBool(v LValue) bool
- func LVAsString(v LValue) string
- func LVCanConvToString(v LValue) bool
- func LVIsFalse(v LValue) bool
- func OpenBase(L *LState) int
- func OpenChannel(L *LState) int
- func OpenCoroutine(L *LState) int
- func OpenDebug(L *LState) int
- func OpenIo(L *LState) int
- func OpenMath(L *LState) int
- func OpenOs(L *LState) int
- func OpenPackage(L *LState) int
- func OpenString(L *LState) int
- func OpenTable(L *LState) int
- func S2B(s string) (b []byte)
- func UpvalueIndex(i int) int
- func VelaNameE(v string) error
- func WithFunc(gn LGFunction) func(e *Export)
- func WithIndex(ex func(*LState, string) LValue) func(e *Export)
- func WithNewIndex(nex func(*LState, string, LValue)) func(e *Export)
- func WithTable(kv UserKV) func(e *Export)
- type ApiError
- type ApiErrorType
- type CallBackFunction
- type CallFrameFSM
- func (fsm *CallFrameFSM) Index(hook func(*LState, string) LValue) bool
- func (fsm *CallFrameFSM) Meta(hook func(*LState, LValue) LValue) bool
- func (fsm *CallFrameFSM) NewIndex(hook func(*LState, string, LValue)) bool
- func (fsm *CallFrameFSM) NewMeta(hook func(*LState, LValue, LValue)) bool
- func (fsm *CallFrameFSM) OpCode() int
- type Closer
- type CompileError
- type Console
- type DbgCall
- type DbgLocalInfo
- type Debug
- type ExData
- type ExDataKV
- type Export
- func (e Export) AssertFloat64() (float64, bool)
- func (e Export) AssertFunction() (*LFunction, bool)
- func (e Export) AssertString() (string, bool)
- func (e Export) Hijack(*CallFrameFSM) bool
- func (e Export) Index(L *LState, key string) LValue
- func (e Export) NewIndex(L *LState, key string, val LValue)
- func (e Export) String() string
- func (e Export) Type() LValueType
- type FunctionProto
- type Generic
- func (gen *Generic[T]) AssertFloat64() (float64, bool)
- func (gen *Generic[T]) AssertFunction() (*LFunction, bool)
- func (gen *Generic[T]) AssertString() (string, bool)
- func (gen *Generic[T]) GobDecode(data []byte) error
- func (gen *Generic[T]) GobEncode() ([]byte, error)
- func (gen *Generic[T]) Hijack(fsm *CallFrameFSM) bool
- func (gen *Generic[T]) Index(L *LState, key string) LValue
- func (gen *Generic[T]) LValue() (LValue, bool)
- func (gen *Generic[T]) MarshalJSON() ([]byte, error)
- func (gen *Generic[T]) Meta(L *LState, key LValue) LValue
- func (gen *Generic[T]) NewIndex(L *LState, key string, val LValue)
- func (gen *Generic[T]) NewMeta(L *LState, key LValue, val LValue)
- func (gen *Generic[T]) String() string
- func (gen *Generic[T]) ToLValue() LValue
- func (gen *Generic[T]) Type() LValueType
- func (gen *Generic[T]) UnmarshalJSON(bytes []byte) error
- type Global
- type GoFuncErr
- type GoFuncInt
- func (gi GoFuncInt) AssertFloat64() (float64, bool)
- func (gi GoFuncInt) AssertFunction() (*LFunction, bool)
- func (gi GoFuncInt) AssertString() (string, bool)
- func (gi GoFuncInt) Hijack(*CallFrameFSM) bool
- func (gi GoFuncInt) Peek() LValue
- func (gi GoFuncInt) String() string
- func (gi GoFuncInt) Type() LValueType
- type GoFuncStr
- type GoFunction
- type IO
- type IndexEx
- type JsonEncoder
- func (enc *JsonEncoder) Arr(name string)
- func (enc *JsonEncoder) Bool(v bool)
- func (enc *JsonEncoder) Bytes() []byte
- func (enc *JsonEncoder) Char(ch byte)
- func (enc *JsonEncoder) End(val string)
- func (enc *JsonEncoder) False(key string)
- func (enc *JsonEncoder) Float32(f float32)
- func (enc *JsonEncoder) Float64(f float64)
- func (enc *JsonEncoder) Insert(v []byte)
- func (enc *JsonEncoder) Int(n int)
- func (enc *JsonEncoder) Join(key string, v []string)
- func (enc *JsonEncoder) KB(key string, b bool)
- func (enc *JsonEncoder) KF64(key string, v float64)
- func (enc *JsonEncoder) KI(key string, n int)
- func (enc *JsonEncoder) KL(key string, n int64)
- func (enc *JsonEncoder) KT(key string, t time.Time)
- func (enc *JsonEncoder) KUL(key string, n uint64)
- func (enc *JsonEncoder) KV(key string, s interface{})
- func (enc *JsonEncoder) Key(key string)
- func (enc *JsonEncoder) Len() int
- func (enc *JsonEncoder) Long(n int64)
- func (enc *JsonEncoder) Raw(key string, val []byte)
- func (enc *JsonEncoder) Reset()
- func (enc *JsonEncoder) Tab(name string)
- func (enc *JsonEncoder) True(key string)
- func (enc *JsonEncoder) ULong(n uint64)
- func (enc *JsonEncoder) Val(v string)
- func (enc *JsonEncoder) Write(val []byte)
- func (enc *JsonEncoder) WriteByte(ch byte)
- func (enc *JsonEncoder) WriteString(val string)
- type LBool
- type LChannel
- type LFunction
- func (fn *LFunction) AssertFloat64() (float64, bool)
- func (fn *LFunction) AssertFunction() (*LFunction, bool)
- func (fn *LFunction) AssertString() (string, bool)
- func (fn *LFunction) Hijack(*CallFrameFSM) bool
- func (fn *LFunction) LocalName(regno, pc int) (string, bool)
- func (fn *LFunction) String() string
- func (fn *LFunction) Type() LValueType
- type LGFunction
- type LInt
- type LInt64
- type LNilType
- func (nl *LNilType) AssertFloat64() (float64, bool)
- func (nl *LNilType) AssertFunction() (*LFunction, bool)
- func (nl *LNilType) AssertString() (string, bool)
- func (nl *LNilType) Hijack(*CallFrameFSM) bool
- func (nl *LNilType) Peek() LValue
- func (nl *LNilType) String() string
- func (nl *LNilType) Type() LValueType
- type LNumber
- func (nm LNumber) AssertFloat64() (float64, bool)
- func (nm LNumber) AssertFunction() (*LFunction, bool)
- func (nm LNumber) AssertString() (string, bool)
- func (nm LNumber) Format(f fmt.State, c rune)
- func (nm LNumber) Hijack(*CallFrameFSM) bool
- func (nm LNumber) String() string
- func (nm LNumber) Type() LValueType
- type LState
- func (ls *LState) A() interface{}
- func (ls *LState) ArgError(n int, message string)
- func (ls *LState) AssertFloat64() (float64, bool)
- func (ls *LState) AssertFunction() (*LFunction, bool)
- func (ls *LState) AssertString() (string, bool)
- func (ls *LState) B() interface{}
- func (ls *LState) C() interface{}
- func (ls *LState) Call(nargs, nret int)
- func (ls *LState) CallByParam(cp P, args ...LValue) error
- func (ls *LState) CallMeta(obj LValue, event string) LValue
- func (ls *LState) Callback(fn CallBackFunction)
- func (ls *LState) CheckAny(n int) LValue
- func (ls *LState) CheckBool(n int) bool
- func (ls *LState) CheckChannel(n int) chan LValue
- func (ls *LState) CheckCodeVM(name string) bool
- func (ls *LState) CheckFile(n int) string
- func (ls *LState) CheckFunction(n int) *LFunction
- func (ls *LState) CheckIndexEx(id int) IndexEx
- func (ls *LState) CheckInt(n int) int
- func (ls *LState) CheckInt64(n int) int64
- func (ls *LState) CheckNumber(n int) LNumber
- func (ls *LState) CheckObject(n int) LValue
- func (ls *LState) CheckOption(n int, options []string) int
- func (ls *LState) CheckSocket(n int) string
- func (ls *LState) CheckSockets(n int) string
- func (ls *LState) CheckString(n int) string
- func (ls *LState) CheckTable(n int) *LTable
- func (ls *LState) CheckThread(n int) *LState
- func (ls *LState) CheckType(n int, typ LValueType)
- func (ls *LState) CheckTypes(n int, typs ...LValueType)
- func (ls *LState) CheckUserData(n int) *LUserData
- func (ls *LState) CheckVelaData(n int) *VelaData
- func (ls *LState) Close()
- func (ls *LState) CodeVM() string
- func (ls *LState) Concat(values ...LValue) string
- func (ls *LState) Context() context.Context
- func (ls *LState) Copy(L *LState)
- func (ls *LState) CreateTable(acap, hcap int) *LTable
- func (ls *LState) D() interface{}
- func (ls *LState) DoFile(path string) error
- func (ls *LState) DoString(source string) error
- func (ls *LState) E() interface{}
- func (ls *LState) Equal(lhs, rhs LValue) bool
- func (ls *LState) Error(lv LValue, level int)
- func (ls *LState) FindTable(obj *LTable, n string, size int) LValue
- func (ls *LState) ForEach(tb *LTable, cb func(LValue, LValue))
- func (ls *LState) GPCall(fn LGFunction, data LValue) error
- func (ls *LState) Get(idx int) LValue
- func (ls *LState) GetFEnv(obj LValue) LValue
- func (ls *LState) GetField(obj LValue, skey string) LValue
- func (ls *LState) GetGlobal(name string) LValue
- func (ls *LState) GetInfo(what string, dbg *Debug, fn LValue) (LValue, error)
- func (ls *LState) GetLocal(dbg *Debug, no int) (string, LValue)
- func (ls *LState) GetMetaField(obj LValue, event string) LValue
- func (ls *LState) GetMetatable(obj LValue) LValue
- func (ls *LState) GetStack(level int) (*Debug, bool)
- func (ls *LState) GetTable(obj LValue, key LValue) LValue
- func (ls *LState) GetTop() int
- func (ls *LState) GetTypeMetatable(typ string) LValue
- func (ls *LState) GetUpvalue(fn *LFunction, no int) (string, LValue)
- func (ls *LState) Hijack(*CallFrameFSM) bool
- func (ls *LState) Insert(value LValue, index int)
- func (ls *LState) IsClosed() bool
- func (ls *LState) IsFalse(n int) bool
- func (ls *LState) IsFunc(n int) *LFunction
- func (ls *LState) IsInt(n int) int
- func (ls *LState) IsNumber(n int) LNumber
- func (ls *LState) IsString(n int) string
- func (ls *LState) IsTrue(n int) bool
- func (ls *LState) Keepalive()
- func (ls *LState) LessThan(lhs, rhs LValue) bool
- func (ls *LState) Load(reader io.Reader, name string) (*LFunction, error)
- func (ls *LState) LoadFile(path string) (*LFunction, error)
- func (ls *LState) LoadString(source string) (*LFunction, error)
- func (ls *LState) Metadata(id int) interface{}
- func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction
- func (ls *LState) NewFunction(fn LGFunction) *LFunction
- func (ls *LState) NewFunctionFromProto(proto *FunctionProto) *LFunction
- func (ls *LState) NewTable() *LTable
- func (ls *LState) NewThread() (*LState, context.CancelFunc)
- func (ls *LState) NewTypeMetatable(typ string) *LTable
- func (ls *LState) NewUserData() *LUserData
- func (ls *LState) NewVela(key string, typeof string) *VelaData
- func (ls *LState) NewVelaData(key string, typeof string) *VelaData
- func (ls *LState) Next(tb *LTable, key LValue) (LValue, LValue)
- func (ls *LState) ObjLen(v1 LValue) int
- func (ls *LState) OpenLibs()
- func (ls *LState) OptBool(n int, d bool) bool
- func (ls *LState) OptChannel(n int, ch chan LValue) chan LValue
- func (ls *LState) OptFunction(n int, d *LFunction) *LFunction
- func (ls *LState) OptInt(n int, d int) int
- func (ls *LState) OptInt64(n int, d int64) int64
- func (ls *LState) OptNumber(n int, d LNumber) LNumber
- func (ls *LState) OptString(n int, d string) string
- func (ls *LState) OptTable(n int, d *LTable) *LTable
- func (ls *LState) OptUserData(n int, d *LUserData) *LUserData
- func (ls *LState) Output(v string)
- func (ls *LState) PCall(nargs, nret int, errfunc *LFunction) (err error)
- func (ls *LState) Pop(n int)
- func (ls *LState) PreloadModule(name string, loader LGFunction)
- func (ls *LState) Push(value LValue)
- func (ls *LState) PushAny(v interface{})
- func (ls *LState) Pushf(format string, v ...interface{})
- func (ls *LState) RaiseError(format string, args ...interface{})
- func (ls *LState) RawEqual(lhs, rhs LValue) bool
- func (ls *LState) RawGet(tb *LTable, key LValue) LValue
- func (ls *LState) RawGetInt(tb *LTable, key int) LValue
- func (ls *LState) RawSet(tb *LTable, key LValue, value LValue)
- func (ls *LState) RawSetInt(tb *LTable, key int, value LValue)
- func (ls *LState) Register(name string, fn LGFunction)
- func (ls *LState) RegisterModule(name string, funcs map[string]LGFunction) LValue
- func (ls *LState) Remove(index int)
- func (ls *LState) RemoveCallerFrame() *callFrame
- func (ls *LState) RemoveContext() context.Context
- func (ls *LState) Replace(idx int, value LValue)
- func (ls *LState) Resume(th *LState, fn *LFunction, args ...LValue) (ResumeState, error, []LValue)
- func (ls *LState) SetA(v interface{})
- func (ls *LState) SetB(v interface{})
- func (ls *LState) SetC(v interface{})
- func (ls *LState) SetContext(ctx context.Context)
- func (ls *LState) SetD(v interface{})
- func (ls *LState) SetE(v interface{})
- func (ls *LState) SetFEnv(obj LValue, env LValue)
- func (ls *LState) SetField(obj LValue, key string, value LValue)
- func (ls *LState) SetFuncs(tb *LTable, funcs map[string]LGFunction, upvalues ...LValue) *LTable
- func (ls *LState) SetGlobal(name string, value LValue)
- func (ls *LState) SetLocal(dbg *Debug, no int, lv LValue) string
- func (ls *LState) SetMetadata(id int, v interface{})
- func (ls *LState) SetMetatable(obj LValue, mt LValue)
- func (ls *LState) SetMx(mx int)
- func (ls *LState) SetTable(obj LValue, key LValue, value LValue)
- func (ls *LState) SetTop(idx int)
- func (ls *LState) SetUpvalue(fn *LFunction, no int, lv LValue) string
- func (ls *LState) SetValue(key interface{}, v interface{})
- func (ls *LState) StackTrace(level int) string
- func (ls *LState) Status(th *LState) string
- func (ls *LState) String() string
- func (ls *LState) ToBool(n int) bool
- func (ls *LState) ToChannel(n int) chan LValue
- func (ls *LState) ToFunction(n int) *LFunction
- func (ls *LState) ToInt(n int) int
- func (ls *LState) ToInt64(n int) int64
- func (ls *LState) ToNumber(n int) LNumber
- func (ls *LState) ToString(n int) string
- func (ls *LState) ToStringMeta(lv LValue) LValue
- func (ls *LState) ToTable(n int) *LTable
- func (ls *LState) ToThread(n int) *LState
- func (ls *LState) ToUserData(n int) *LUserData
- func (ls *LState) Type() LValueType
- func (ls *LState) TypeError(n int, typ LValueType)
- func (ls *LState) Use(value LValue)
- func (ls *LState) Value(key interface{}) interface{}
- func (ls *LState) Where(level int) string
- func (ls *LState) WithValue(key interface{}, v interface{}) context.Context
- func (ls *LState) XMoveTo(other *LState, n int)
- func (ls *LState) Yield(values ...LValue) int
- type LString
- func (st LString) AssertFloat64() (float64, bool)
- func (st LString) AssertFunction() (*LFunction, bool)
- func (st LString) AssertString() (string, bool)
- func (st LString) Format(f fmt.State, c rune)
- func (st LString) Hijack(*CallFrameFSM) bool
- func (st LString) String() string
- func (st LString) Type() LValueType
- type LTable
- func (tb *LTable) Append(value LValue)
- func (tb *LTable) Array() []LValue
- func (tb *LTable) AssertFloat64() (float64, bool)
- func (tb *LTable) AssertFunction() (*LFunction, bool)
- func (tb *LTable) AssertString() (string, bool)
- func (tb *LTable) CheckBool(key string, d bool) bool
- func (tb *LTable) CheckInt(key string, d int) int
- func (tb *LTable) CheckSocket(key string, L *LState) string
- func (tb *LTable) CheckSockets(key string, L *LState) string
- func (tb *LTable) CheckString(key string, d string) string
- func (tb *LTable) CheckUint32(key string, d uint32) uint32
- func (tb *LTable) CheckVelaData(L *LState, key string) *VelaData
- func (tb *LTable) ForEach(cb func(LValue, LValue))
- func (tb *LTable) Hijack(*CallFrameFSM) bool
- func (tb *LTable) Insert(i int, value LValue)
- func (tb *LTable) Int() []int
- func (tb *LTable) Int64() []int64
- func (tb *LTable) IsArray() bool
- func (tb *LTable) Len() int
- func (tb *LTable) MaxN() int
- func (tb *LTable) Next(key LValue) (LValue, LValue)
- func (tb *LTable) Pickup(vt LValueType, fn func(lv LValue))
- func (tb *LTable) Range(cb func(string, LValue))
- func (tb *LTable) RangeDict(cb func(LValue, LValue) bool)
- func (tb *LTable) RangeStrDict(cb func(string, LValue) bool)
- func (tb *LTable) RawGet(key LValue) LValue
- func (tb *LTable) RawGetH(key LValue) LValue
- func (tb *LTable) RawGetInt(key int) LValue
- func (tb *LTable) RawGetString(key string) LValue
- func (tb *LTable) RawSet(key LValue, value LValue)
- func (tb *LTable) RawSetH(key LValue, value LValue)
- func (tb *LTable) RawSetInt(key int, value LValue)
- func (tb *LTable) RawSetString(key string, value LValue)
- func (tb *LTable) Remove(pos int) LValue
- func (tb *LTable) String() string
- func (tb *LTable) Strings() []string
- func (tb *LTable) Type() LValueType
- func (tb *LTable) Uint() []int
- func (tb *LTable) Uint64() []int64
- type LUint
- type LUint64
- type LUserData
- type LVFace
- type LValue
- type LValueType
- type MetaEx
- type MetaTableEx
- type NewIndexEx
- type NewMetaEx
- type OptionEx
- type OptionFunc
- type Options
- type P
- type Reader
- type ReaderCloser
- type ResumeState
- type Sample
- type SuperVelaData
- func (sv *SuperVelaData) CodeVM() string
- func (sv *SuperVelaData) Help(out Console)
- func (sv *SuperVelaData) Index(*LState, string) LValue
- func (sv *SuperVelaData) Init(typeof string)
- func (sv *SuperVelaData) IsClose() bool
- func (sv *SuperVelaData) IsInit() bool
- func (sv *SuperVelaData) IsPanic() bool
- func (sv *SuperVelaData) IsRun() bool
- func (sv *SuperVelaData) Meta(*LState, LValue) LValue
- func (sv *SuperVelaData) Name() string
- func (sv *SuperVelaData) NewIndex(*LState, string, LValue)
- func (sv *SuperVelaData) NewMeta(*LState, LValue, LValue)
- func (sv *SuperVelaData) Show(out Console)
- func (sv *SuperVelaData) State() VelaState
- func (sv *SuperVelaData) Type() string
- func (sv *SuperVelaData) V(opts ...interface{})
- type Upvalue
- type UserKV
- type VelaCode
- type VelaData
- func (vd *VelaData) AssertFloat64() (float64, bool)
- func (vd *VelaData) AssertFunction() (*LFunction, bool)
- func (vd *VelaData) AssertString() (string, bool)
- func (vd *VelaData) Close() error
- func (vd *VelaData) CodeVM() string
- func (vd *VelaData) Hijack(fsm *CallFrameFSM) bool
- func (vd *VelaData) IsNil() bool
- func (vd *VelaData) IsPrivate() bool
- func (vd *VelaData) Private(L *LState)
- func (vd *VelaData) Set(v VelaEntry)
- func (vd *VelaData) String() string
- func (vd *VelaData) Type() LValueType
- type VelaEntry
- type VelaState
- type Writer
- type WriterCloser
Constants ¶
const ( VarArgHasArg uint8 = 1 VarArgIsVarArg uint8 = 2 VarArgNeedsArg uint8 = 4 )
const ( // BaseLibName is here for consistency; the base functions have no namespace/library. BaseLibName = "" // LoadLibName is here for consistency; the loading system has no namespace/library. LoadLibName = "package" // TabLibName is the name of the table Library. TabLibName = "table" // IoLibName is the name of the io Library. IoLibName = "io" // OsLibName is the name of the os Library. OsLibName = "os" // StringLibName is the name of the string Library. StringLibName = "string" // MathLibName is the name of the math Library. MathLibName = "math" // DebugLibName is the name of the debug Library. DebugLibName = "debug" // ChannelLibName is the name of the channel Library. ChannelLibName = "channel" // CoroutineLibName is the name of the coroutine Library. CoroutineLibName = "coroutine" )
const ( OP_MOVE int = iota /* A B R(A) := R(B) */ OP_MOVEN /* A B R(A) := R(B); followed by R(C) MOVE ops */ OP_LOADK /* A Bx R(A) := Kst(Bx) */ OP_LOADBOOL /* A B C R(A) := (Bool)B; if (C) pc++ */ OP_LOADNIL /* A B R(A) := ... := R(B) := nil */ OP_GETUPVAL /* A B R(A) := UpValue[B] */ OP_GETGLOBAL /* A Bx R(A) := Gbl[Kst(Bx)] */ OP_GETTABLE /* A B C R(A) := R(B)[RK(C)] */ OP_GETTABLEKS /* A B C R(A) := R(B)[RK(C)] ; RK(C) is constant string */ OP_SETGLOBAL /* A Bx Gbl[Kst(Bx)] := R(A) */ OP_SETUPVAL /* A B UpValue[B] := R(A) */ OP_SETTABLE /* A B C R(A)[RK(B)] := RK(C) */ OP_SETTABLEKS /* A B C R(A)[RK(B)] := RK(C) ; RK(B) is constant string */ OP_NEWTABLE /* A B C R(A) := {} (size = BC) */ OP_SELF /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ OP_ADD /* A B C R(A) := RK(B) + RK(C) */ OP_SUB /* A B C R(A) := RK(B) - RK(C) */ OP_MUL /* A B C R(A) := RK(B) * RK(C) */ OP_DIV /* A B C R(A) := RK(B) / RK(C) */ OP_MOD /* A B C R(A) := RK(B) % RK(C) */ OP_POW /* A B C R(A) := RK(B) ^ RK(C) */ OP_UNM /* A B R(A) := -R(B) */ OP_NOT /* A B R(A) := not R(B) */ OP_LEN /* A B R(A) := length of R(B) */ OP_CONCAT /* A B C R(A) := R(B).. ... ..R(C) */ OP_JMP /* sBx pc+=sBx */ OP_EQ /* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ OP_LT /* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ OP_LE /* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ OP_TEST /* A C if not (R(A) <=> C) then pc++ */ OP_TESTSET /* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ OP_CALL /* A B C R(A) ... R(A+C-2) := R(A)(R(A+1) ... R(A+B-1)) */ OP_TAILCALL /* A B C return R(A)(R(A+1) ... R(A+B-1)) */ OP_RETURN /* A B return R(A) ... R(A+B-2) (see note) */ OP_FORLOOP /* A sBx R(A)+=R(A+2); if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/ OP_FORPREP /* A sBx R(A)-=R(A+2); pc+=sBx */ OP_TFORLOOP /* A C R(A+3) ... R(A+3+C) := R(A)(R(A+1) R(A+2)); if R(A+3) ~= nil then { pc++; R(A+2)=R(A+3); } */ OP_SETLIST /* A B C R(A)[(C-1)*FPF+i] := R(A+i) 1 <= i <= B */ OP_CLOSE /* A close all variables in the stack up to (>=) R(A)*/ OP_CLOSURE /* A Bx R(A) := closure(KPROTO[Bx] R(A) ... R(A+n)) */ OP_VARARG /* A B R(A) R(A+1) ... R(A+B-1) = vararg */ OP_NOP /* NOP */ )
const ( M0 int = iota M1 M2 M3 M4 M5 M6 )
const (
EmptyString = LString("")
)
const EnvironIndex = -10001
const FramesPerSegment = 8
FramesPerSegment should be a power of 2 constant for performance reasons. It will allow the go compiler to change the divs and mods into bitshifts. Max is 256 due to current use of uint8 to count how many frames in a segment are used.
const GlobalsIndex = -10002
const LNumberBit = 64
const LNumberScanFormat = "%f"
const LuaVersion = "Lua 5.1"
const MultRet = -1
const PackageAuthors = "Yusuke Inuzuka"
const PackageCopyRight = PackageName + " " + PackageVersion + " Copyright (C) 2015 -2017 " + PackageAuthors
const PackageName = "GopherLua"
const PackageVersion = "0.1"
const RegistryIndex = -10000
Variables ¶
var ( InvalidFormat = errors.New("invalid format") InvalidIP = errors.New("invalid ip addr") InvalidPort = errors.New("expect check socket err: port <1 or port > 65535") )
var ( Esc = []byte{'\\', '\\'} CR = []byte{'\\', '\r'} CN = []byte{'\\', '\n'} CT = []byte{'\\', '\t'} Quotation = []byte{'\\', '"'} )
var ( InvalidVelaName = errors.New("invalid name") AlreadyRun = errors.New("already running") NotFoundCode = errors.New("not found code") NotFoundVelaData = errors.New("not found vela data") InvalidVelaData = errors.New("invalid vela data") InvalidTree = errors.New("invalid tree") NotFoundTree = errors.New("not found tree") )
var CallStackSize = 256
var CompatVarArg = true
var False = []byte("false")
var FieldsPerFlush = 50
var LFalse = LBool(false)
var LNil = LValue(&LNilType{})
var LTrue = LBool(true)
var LuaDirSep string
var LuaExecDir = "!"
var LuaIgMark = "-"
var LuaLDir string
var LuaOS string
var LuaPath = "LUA_PATH"
var LuaPathDefault string
var LuaPathMark = "?"
var LuaPathSep = ";"
var MaxArrayIndex = 67108864
var MaxTableGetLoop = 100
var RegistryGrowStep = 32
var RegistrySize = 256 * 20
var True = []byte("true")
var VelaStateValue = [...]string{"init", "run", "error", "close", "panic", "private", "mode"}
Functions ¶
func CheckInt64 ¶
func CheckSocket ¶
func CheckString ¶
func FileSuffix ¶
func HijackTable ¶ added in v1.5.0
func HijackTable(fsm *CallFrameFSM) bool
func LVAsString ¶
LVAsString returns string representation of a given LValue if the LValue is a string or number, otherwise an empty string.
func LVCanConvToString ¶
LVCanConvToString returns true if a given LValue is a string or number otherwise false.
func OpenChannel ¶
func OpenCoroutine ¶
func OpenPackage ¶
func OpenString ¶
func UpvalueIndex ¶
func WithFunc ¶
func WithFunc(gn LGFunction) func(e *Export)
Types ¶
type ApiError ¶
type ApiError struct {
Type ApiErrorType
Object LValue
StackTrace string
// Underlying error. This attribute is set only if the Type is ApiErrorFile or ApiErrorSyntax
Cause error
}
type ApiErrorType ¶
type ApiErrorType int
const ( ApiErrorSyntax ApiErrorType = iota ApiErrorFile ApiErrorRun ApiErrorError ApiErrorPanic )
type CallBackFunction ¶
type CallFrameFSM ¶ added in v1.5.0
type CallFrameFSM struct {
// contains filtered or unexported fields
}
func (*CallFrameFSM) Index ¶ added in v1.5.0
func (fsm *CallFrameFSM) Index(hook func(*LState, string) LValue) bool
func (*CallFrameFSM) Meta ¶ added in v1.5.0
func (fsm *CallFrameFSM) Meta(hook func(*LState, LValue) LValue) bool
func (*CallFrameFSM) NewIndex ¶ added in v1.5.0
func (fsm *CallFrameFSM) NewIndex(hook func(*LState, string, LValue)) bool
func (*CallFrameFSM) NewMeta ¶ added in v1.5.0
func (fsm *CallFrameFSM) NewMeta(hook func(*LState, LValue, LValue)) bool
func (*CallFrameFSM) OpCode ¶ added in v1.5.0
func (fsm *CallFrameFSM) OpCode() int
type Closer ¶
func CheckCloser ¶
type CompileError ¶
func (*CompileError) Error ¶
func (e *CompileError) Error() string
type DbgLocalInfo ¶
type Debug ¶
type Export ¶
type Export struct {
// contains filtered or unexported fields
}
func (Export) AssertFloat64 ¶
func (Export) AssertFunction ¶
func (Export) AssertString ¶
func (Export) Hijack ¶ added in v1.5.0
func (e Export) Hijack(*CallFrameFSM) bool
func (Export) Type ¶
func (e Export) Type() LValueType
type FunctionProto ¶
type FunctionProto struct {
SourceName string
LineDefined int
LastLineDefined int
NumUpvalues uint8
NumParameters uint8
IsVarArg uint8
NumUsedRegisters uint8
Code []uint32
Constants []LValue
FunctionPrototypes []*FunctionProto
DbgSourcePositions []int
DbgLocals []*DbgLocalInfo
DbgCalls []DbgCall
DbgUpvalues []string
// contains filtered or unexported fields
}
func (*FunctionProto) String ¶
func (fp *FunctionProto) String() string
type Generic ¶ added in v1.5.0
type Generic[T any] struct { Data T }
func NewGeneric ¶ added in v1.5.0
func (*Generic[T]) AssertFloat64 ¶ added in v1.5.0
func (*Generic[T]) AssertFunction ¶ added in v1.5.0
func (*Generic[T]) AssertString ¶ added in v1.5.0
func (*Generic[T]) Hijack ¶ added in v1.5.0
func (gen *Generic[T]) Hijack(fsm *CallFrameFSM) bool
func (*Generic[T]) MarshalJSON ¶ added in v1.5.0
func (*Generic[T]) Type ¶ added in v1.5.0
func (gen *Generic[T]) Type() LValueType
func (*Generic[T]) UnmarshalJSON ¶ added in v1.5.0
type GoFuncErr ¶
type GoFuncErr func(...interface{}) error
func (GoFuncErr) AssertFloat64 ¶
func (GoFuncErr) AssertFunction ¶
func (GoFuncErr) AssertString ¶
func (GoFuncErr) Hijack ¶ added in v1.5.0
func (ge GoFuncErr) Hijack(*CallFrameFSM) bool
func (GoFuncErr) Type ¶
func (ge GoFuncErr) Type() LValueType
type GoFuncInt ¶
type GoFuncInt func(...interface{}) int
func (GoFuncInt) AssertFloat64 ¶
func (GoFuncInt) AssertFunction ¶
func (GoFuncInt) AssertString ¶
func (GoFuncInt) Hijack ¶ added in v1.5.0
func (gi GoFuncInt) Hijack(*CallFrameFSM) bool
func (GoFuncInt) Type ¶
func (gi GoFuncInt) Type() LValueType
type GoFuncStr ¶
type GoFuncStr func(...interface{}) string
func (GoFuncStr) AssertFloat64 ¶
func (GoFuncStr) AssertFunction ¶
func (GoFuncStr) AssertString ¶
func (GoFuncStr) Hijack ¶ added in v1.5.0
func (gs GoFuncStr) Hijack(*CallFrameFSM) bool
func (GoFuncStr) Type ¶
func (gs GoFuncStr) Type() LValueType
type GoFunction ¶
type GoFunction func() error
func (GoFunction) AssertFloat64 ¶
func (fn GoFunction) AssertFloat64() (float64, bool)
func (GoFunction) AssertFunction ¶
func (fn GoFunction) AssertFunction() (*LFunction, bool)
func (GoFunction) AssertString ¶
func (fn GoFunction) AssertString() (string, bool)
func (GoFunction) Hijack ¶ added in v1.5.0
func (fn GoFunction) Hijack(*CallFrameFSM) bool
func (GoFunction) String ¶
func (fn GoFunction) String() string
func (GoFunction) Type ¶
func (fn GoFunction) Type() LValueType
type JsonEncoder ¶
type JsonEncoder struct {
// contains filtered or unexported fields
}
func Json ¶
func Json(cap int) *JsonEncoder
func (*JsonEncoder) Arr ¶
func (enc *JsonEncoder) Arr(name string)
func (*JsonEncoder) Bool ¶
func (enc *JsonEncoder) Bool(v bool)
func (*JsonEncoder) Bytes ¶
func (enc *JsonEncoder) Bytes() []byte
func (*JsonEncoder) Char ¶
func (enc *JsonEncoder) Char(ch byte)
func (*JsonEncoder) End ¶
func (enc *JsonEncoder) End(val string)
func (*JsonEncoder) False ¶
func (enc *JsonEncoder) False(key string)
func (*JsonEncoder) Float32 ¶
func (enc *JsonEncoder) Float32(f float32)
func (*JsonEncoder) Float64 ¶
func (enc *JsonEncoder) Float64(f float64)
func (*JsonEncoder) Insert ¶
func (enc *JsonEncoder) Insert(v []byte)
func (*JsonEncoder) Int ¶
func (enc *JsonEncoder) Int(n int)
func (*JsonEncoder) Join ¶
func (enc *JsonEncoder) Join(key string, v []string)
func (*JsonEncoder) KB ¶
func (enc *JsonEncoder) KB(key string, b bool)
func (*JsonEncoder) KF64 ¶
func (enc *JsonEncoder) KF64(key string, v float64)
func (*JsonEncoder) KI ¶
func (enc *JsonEncoder) KI(key string, n int)
func (*JsonEncoder) KL ¶
func (enc *JsonEncoder) KL(key string, n int64)
func (*JsonEncoder) KUL ¶
func (enc *JsonEncoder) KUL(key string, n uint64)
func (*JsonEncoder) KV ¶
func (enc *JsonEncoder) KV(key string, s interface{})
func (*JsonEncoder) Key ¶
func (enc *JsonEncoder) Key(key string)
func (*JsonEncoder) Len ¶
func (enc *JsonEncoder) Len() int
func (*JsonEncoder) Long ¶
func (enc *JsonEncoder) Long(n int64)
func (*JsonEncoder) Raw ¶
func (enc *JsonEncoder) Raw(key string, val []byte)
func (*JsonEncoder) Reset ¶
func (enc *JsonEncoder) Reset()
func (*JsonEncoder) Tab ¶
func (enc *JsonEncoder) Tab(name string)
func (*JsonEncoder) True ¶
func (enc *JsonEncoder) True(key string)
func (*JsonEncoder) ULong ¶
func (enc *JsonEncoder) ULong(n uint64)
func (*JsonEncoder) Val ¶
func (enc *JsonEncoder) Val(v string)
func (*JsonEncoder) Write ¶
func (enc *JsonEncoder) Write(val []byte)
func (*JsonEncoder) WriteByte ¶
func (enc *JsonEncoder) WriteByte(ch byte)
func (*JsonEncoder) WriteString ¶
func (enc *JsonEncoder) WriteString(val string)
type LBool ¶
type LBool bool
func (LBool) AssertFloat64 ¶
func (LBool) AssertFunction ¶
func (LBool) AssertString ¶
func (LBool) Hijack ¶ added in v1.5.0
func (bl LBool) Hijack(*CallFrameFSM) bool
func (LBool) Type ¶
func (bl LBool) Type() LValueType
type LChannel ¶
type LChannel chan LValue
func (LChannel) AssertFloat64 ¶
func (LChannel) AssertFunction ¶
func (LChannel) AssertString ¶
func (LChannel) Hijack ¶ added in v1.5.0
func (ch LChannel) Hijack(*CallFrameFSM) bool
func (LChannel) Type ¶
func (ch LChannel) Type() LValueType
type LFunction ¶
type LFunction struct {
IsG bool
Env *LTable
Proto *FunctionProto
GFunction LGFunction
Upvalues []*Upvalue
}
func CheckFunction ¶
func NewFunction ¶
func NewFunction(gn LGFunction) *LFunction
func (*LFunction) AssertFloat64 ¶
func (*LFunction) AssertFunction ¶
func (*LFunction) AssertString ¶
func (*LFunction) Hijack ¶ added in v1.5.0
func (fn *LFunction) Hijack(*CallFrameFSM) bool
func (*LFunction) Type ¶
func (fn *LFunction) Type() LValueType
type LGFunction ¶
type LInt ¶
type LInt int
func (LInt) AssertFloat64 ¶
func (LInt) AssertFunction ¶
func (LInt) AssertString ¶
func (LInt) Hijack ¶ added in v1.5.0
func (i LInt) Hijack(*CallFrameFSM) bool
func (LInt) Type ¶
func (i LInt) Type() LValueType
type LInt64 ¶
type LInt64 int64
func (LInt64) AssertFloat64 ¶
func (LInt64) AssertFunction ¶
func (LInt64) AssertString ¶
func (LInt64) Hijack ¶ added in v1.5.0
func (i LInt64) Hijack(*CallFrameFSM) bool
func (LInt64) Type ¶
func (i LInt64) Type() LValueType
type LNilType ¶
type LNilType struct{}
func (*LNilType) AssertFloat64 ¶
func (*LNilType) AssertFunction ¶
func (*LNilType) AssertString ¶
func (*LNilType) Hijack ¶ added in v1.5.0
func (nl *LNilType) Hijack(*CallFrameFSM) bool
func (*LNilType) Type ¶
func (nl *LNilType) Type() LValueType
type LNumber ¶
type LNumber float64
func CheckNumber ¶
func LVAsNumber ¶
LVAsNumber tries to convert a given LValue to a number.
func (LNumber) AssertFloat64 ¶
func (LNumber) AssertFunction ¶
func (LNumber) AssertString ¶
func (LNumber) Hijack ¶ added in v1.5.0
func (nm LNumber) Hijack(*CallFrameFSM) bool
func (LNumber) Type ¶
func (nm LNumber) Type() LValueType
type LState ¶
type LState struct {
G *Global
Parent *LState
Env *LTable
Panic func(*LState)
Dead bool
Options Options
Exdata interface{}
Console Console
// contains filtered or unexported fields
}
func (*LState) AssertFloat64 ¶
func (*LState) AssertFunction ¶
func (*LState) AssertString ¶
func (*LState) Callback ¶
func (ls *LState) Callback(fn CallBackFunction)
func (*LState) CheckChannel ¶
Checks whether the given index is an LChannel and returns this channel.
func (*LState) CheckCodeVM ¶
func (*LState) CheckFunction ¶
func (*LState) CheckIndexEx ¶
func (*LState) CheckInt64 ¶
func (*LState) CheckNumber ¶
func (*LState) CheckObject ¶
func (*LState) CheckSocket ¶
func (*LState) CheckSockets ¶
func (*LState) CheckString ¶
func (*LState) CheckTable ¶
func (*LState) CheckThread ¶
func (*LState) CheckType ¶
func (ls *LState) CheckType(n int, typ LValueType)
func (*LState) CheckTypes ¶
func (ls *LState) CheckTypes(n int, typs ...LValueType)
func (*LState) CheckUserData ¶
func (*LState) CheckVelaData ¶
func (*LState) Context ¶
Context returns the LState's context. To change the context, use WithContext.
func (*LState) CreateTable ¶
func (*LState) Error ¶
This function is equivalent to lua_error( http://www.lua.org/manual/5.1/manual.html#lua_error ).
func (*LState) GetMetatable ¶
func (*LState) GetTypeMetatable ¶
func (*LState) Hijack ¶ added in v1.5.0
func (ls *LState) Hijack(*CallFrameFSM) bool
func (*LState) NewClosure ¶
func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction
func (*LState) NewFunction ¶
func (ls *LState) NewFunction(fn LGFunction) *LFunction
func (*LState) NewFunctionFromProto ¶
func (ls *LState) NewFunctionFromProto(proto *FunctionProto) *LFunction
func (*LState) NewThread ¶
func (ls *LState) NewThread() (*LState, context.CancelFunc)
NewThread returns a new LState that shares with the original state all global objects. If the original state has context.Context, the new state has a new child context of the original state and this function returns its cancel function.
func (*LState) NewTypeMetatable ¶
func (*LState) NewUserData ¶
func (*LState) OpenLibs ¶
func (ls *LState) OpenLibs()
OpenLibs loads the built-in libraries. It is equivalent to running OpenLoad, then OpenBase, then iterating over the other OpenXXX functions in any order.
func (*LState) OptChannel ¶
If the given index is a LChannel, returns this channel. If this argument is absent or is nil, returns ch. Otherwise, raises an error.
func (*LState) PreloadModule ¶
func (ls *LState) PreloadModule(name string, loader LGFunction)
Set a module loader to the package.preload table.
func (*LState) RaiseError ¶
This function is equivalent to luaL_error( http://www.lua.org/manual/5.1/manual.html#luaL_error ).
func (*LState) Register ¶
func (ls *LState) Register(name string, fn LGFunction)
func (*LState) RegisterModule ¶
func (ls *LState) RegisterModule(name string, funcs map[string]LGFunction) LValue
func (*LState) RemoveCallerFrame ¶
func (ls *LState) RemoveCallerFrame() *callFrame
RemoveCallerFrame removes the stack frame above the current stack frame. This is useful in tail calls. It returns the new current frame.
func (*LState) RemoveContext ¶
RemoveContext removes the context associated with this LState and returns this context.
func (*LState) SetContext ¶
SetContext set a context ctx to this LState. The provided ctx must be non-nil.
func (*LState) SetMetadata ¶
func (*LState) SetMetatable ¶
func (*LState) SetMx ¶
Set maximum memory size. This function can only be called from the main thread.
func (*LState) StackTrace ¶
func (*LState) ToFunction ¶
func (*LState) ToStringMeta ¶
ToStringMeta returns string representation of given LValue. This method calls the `__tostring` meta method if defined.
func (*LState) ToUserData ¶
func (*LState) Type ¶
func (ls *LState) Type() LValueType
func (*LState) TypeError ¶
func (ls *LState) TypeError(n int, typ LValueType)
type LString ¶
type LString string
func JsonMarshal ¶
func (LString) AssertFloat64 ¶
func (LString) AssertFunction ¶
func (LString) AssertString ¶
func (LString) Hijack ¶ added in v1.5.0
func (st LString) Hijack(*CallFrameFSM) bool
func (LString) Type ¶
func (st LString) Type() LValueType
type LTable ¶
type LTable struct {
Metatable LValue
// contains filtered or unexported fields
}
func CheckTable ¶
func CloneTable ¶
func CreateTable ¶
func (*LTable) AssertFloat64 ¶
func (*LTable) AssertFunction ¶
func (*LTable) AssertString ¶
func (*LTable) CheckString ¶
table check string or default
func (*LTable) CheckUint32 ¶
table check int or default
func (*LTable) ForEach ¶
ForEach iterates over this table of elements, yielding each in turn to a given function.
func (*LTable) Hijack ¶ added in v1.5.0
func (tb *LTable) Hijack(*CallFrameFSM) bool
func (*LTable) Next ¶
This function is equivalent to lua_next ( http://www.lua.org/manual/5.1/manual.html#lua_next ).
func (*LTable) Pickup ¶
func (tb *LTable) Pickup(vt LValueType, fn func(lv LValue))
func (*LTable) RawGet ¶
RawGet returns an LValue associated with a given key without __index metamethod.
func (*LTable) RawGetH ¶
RawGet returns an LValue associated with a given key without __index metamethod.
func (*LTable) RawGetInt ¶
RawGetInt returns an LValue at position `key` without __index metamethod.
func (*LTable) RawGetString ¶
RawGetString returns an LValue associated with a given key without __index metamethod.
func (*LTable) RawSet ¶
RawSet sets a given LValue to a given index without the __newindex metamethod. It is recommended to use `RawSetString` or `RawSetInt` for performance if you already know the given LValue is a string or number.
func (*LTable) RawSetH ¶
RawSetH sets a given LValue to a given index without the __newindex metamethod.
func (*LTable) RawSetInt ¶
RawSetInt sets a given LValue at a position `key` without the __newindex metamethod.
func (*LTable) RawSetString ¶
RawSetString sets a given LValue to a given string index without the __newindex metamethod.
func (*LTable) Type ¶
func (tb *LTable) Type() LValueType
type LUint ¶
type LUint uint
func (LUint) AssertFloat64 ¶
func (LUint) AssertFunction ¶
func (LUint) AssertString ¶
func (LUint) Hijack ¶ added in v1.5.0
func (ui LUint) Hijack(*CallFrameFSM) bool
func (LUint) Type ¶
func (ui LUint) Type() LValueType
type LUint64 ¶
type LUint64 uint64
func (LUint64) AssertFloat64 ¶
func (LUint64) AssertFunction ¶
func (LUint64) AssertString ¶
func (LUint64) Hijack ¶ added in v1.5.0
func (ui LUint64) Hijack(*CallFrameFSM) bool
func (LUint64) Type ¶
func (ui LUint64) Type() LValueType
type LUserData ¶
func (*LUserData) AssertFloat64 ¶
func (*LUserData) AssertFunction ¶
func (*LUserData) AssertString ¶
func (*LUserData) Hijack ¶ added in v1.5.0
func (ud *LUserData) Hijack(*CallFrameFSM) bool
func (*LUserData) Type ¶
func (ud *LUserData) Type() LValueType
type LValue ¶
type LValue interface {
String() string
Type() LValueType
// to reduce `runtime.assertI2T2` costs, this method should be used instead of the type assertion in heavy paths(typically inside the VM).
AssertFloat64() (float64, bool)
// to reduce `runtime.assertI2T2` costs, this method should be used instead of the type assertion in heavy paths(typically inside the VM).
AssertString() (string, bool)
// to reduce `runtime.assertI2T2` costs, this method should be used instead of the type assertion in heavy paths(typically inside the VM).
AssertFunction() (*LFunction, bool)
Hijack(*CallFrameFSM) bool
}
type LValueType ¶
type LValueType int
const ( LTNil LValueType = iota LTBool LTNumber LTInt LTUint LTInt64 LTUint64 LTString LTFunction LTUserData LTThread LTTable LTChannel LTVelaData LTSlice LTMap LTKv LTSkv LTAnyData LTObject LTGoFunction LTGoFuncErr LTGoFuncStr LTGoFuncInt LTGeneric )
func (LValueType) String ¶
func (vt LValueType) String() string
type MetaTableEx ¶
MetaTableEx 通过 string 获取 内容 a:key()
type NewIndexEx ¶
type OptionFunc ¶
type OptionFunc func(*OptionEx)
func After ¶
func After(fn func() error) OptionFunc
func Before ¶
func Before(fn func() error) OptionFunc
func WithState ¶
func WithState(co *LState) OptionFunc
type Options ¶
type Options struct {
// Call stack size. This defaults to `lua.CallStackSize`.
CallStackSize int
// Data stack size. This defaults to `lua.RegistrySize`.
RegistrySize int
// Allow the registry to grow from the registry size specified up to a value of RegistryMaxSize. A value of 0
// indicates no growth is permitted. The registry will not shrink again after any growth.
RegistryMaxSize int
// If growth is enabled, step up by an additional `RegistryGrowStep` each time to avoid having to resize too often.
// This defaults to `lua.RegistryGrowStep`
RegistryGrowStep int
// Controls whether or not libraries are opened by default
SkipOpenLibs bool
// Tells whether a Go stacktrace should be included in a Lua stacktrace when panics occur.
IncludeGoStackTrace bool
// If `MinimizeStackMemory` is set, the call stack will be automatically grown or shrank up to a limit of
// `CallStackSize` in order to minimize memory usage. This does incur a slight performance penalty.
MinimizeStackMemory bool
}
Options is a configuration that is used to create a new LState.
type Reader ¶
func CheckReader ¶
type ResumeState ¶
type ResumeState int
const ( ResumeOK ResumeState = iota ResumeYield ResumeError )
type SuperVelaData ¶
type SuperVelaData struct {
Uptime time.Time
Status VelaState
TypeOf string
// contains filtered or unexported fields
}
SuperVelaData 防止过多的方法定义
func (*SuperVelaData) CodeVM ¶
func (sv *SuperVelaData) CodeVM() string
func (*SuperVelaData) Help ¶
func (sv *SuperVelaData) Help(out Console)
func (*SuperVelaData) Init ¶
func (sv *SuperVelaData) Init(typeof string)
func (*SuperVelaData) IsClose ¶
func (sv *SuperVelaData) IsClose() bool
func (*SuperVelaData) IsInit ¶
func (sv *SuperVelaData) IsInit() bool
func (*SuperVelaData) IsPanic ¶
func (sv *SuperVelaData) IsPanic() bool
func (*SuperVelaData) IsRun ¶
func (sv *SuperVelaData) IsRun() bool
func (*SuperVelaData) Name ¶
func (sv *SuperVelaData) Name() string
func (*SuperVelaData) Show ¶
func (sv *SuperVelaData) Show(out Console)
func (*SuperVelaData) State ¶
func (sv *SuperVelaData) State() VelaState
func (*SuperVelaData) Type ¶
func (sv *SuperVelaData) Type() string
func (*SuperVelaData) V ¶
func (sv *SuperVelaData) V(opts ...interface{})
type UserKV ¶
func NewSafeUserKV ¶
func NewSafeUserKV() UserKV
type VelaData ¶
type VelaData struct {
Data VelaEntry
// contains filtered or unexported fields
}
func NewVelaData ¶
func (*VelaData) AssertFloat64 ¶
func (*VelaData) AssertFunction ¶
func (*VelaData) AssertString ¶
func (*VelaData) Hijack ¶ added in v1.5.0
func (vd *VelaData) Hijack(fsm *CallFrameFSM) bool
func (*VelaData) Type ¶
func (vd *VelaData) Type() LValueType
type VelaEntry ¶
type VelaEntry interface {
Name() string //获取当前对象名称
Type() string //获取对象类型
State() VelaState //获取状态
Start() error
Close() error
NewMeta(*LState, LValue, LValue) //设置字段
Meta(*LState, LValue) LValue //获取字段
Index(*LState, string) LValue //获取字符串字段 __index function
NewIndex(*LState, string, LValue) //设置字段 __newindex function
Show(Console) //控制台打印
Help(Console) //控制台 辅助信息
//V 设置信息
V(...interface{})
}
type Writer ¶
func CheckWriter ¶
Source Files
¶
- alloc.go
- auxlib.go
- baselib.go
- channellib.go
- compile.go
- config.go
- coroutinelib.go
- debuglib.go
- function.go
- generic.go
- hijack.go
- iolib.go
- linit.go
- loadlib.go
- mathlib.go
- opcode.go
- oslib.go
- package.go
- state.go
- stringlib.go
- table.go
- tablelib.go
- utils.go
- value.go
- vela_aux.go
- vela_codec.go
- vela_const.go
- vela_ctx.go
- vela_data.go
- vela_data_lua.go
- vela_data_super.go
- vela_debug.go
- vela_export.go
- vela_function.go
- vela_iface.go
- vela_integer.go
- vela_kv.go
- vela_opt.go
- vela_state.go
- vela_tab.go
- vm.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cast provides easy and safe casting in Go.
|
Package cast provides easy and safe casting in Go. |
|
Lua pattern match functions for Go
|
Lua pattern match functions for Go |