gopher-lua: github.com/yuin/gopher-lua Index | Files | Directories

package lua

import "github.com/yuin/gopher-lua"

GopherLua: VM and compiler for Lua in Go

Index

Package Files

alloc.go auxlib.go baselib.go channellib.go compile.go config.go coroutinelib.go debuglib.go function.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 vm.go

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 EnvironIndex = -10001
const GlobalsIndex = -10002
const LNumberBit = 64
const LNumberScanFormat = "%f"
const MultRet = -1
const PackageAuthors = "Yusuke Inuzuka"
const PackageCopyRight = PackageName + " " + PackageVersion + " Copyright (C) 2015 " + PackageAuthors
const PackageName = "GopherLua"
const PackageVersion = "0.1"
const RegistryIndex = -10000

Variables

var CallStackSize = 256
var CompatVarArg = true
var FieldsPerFlush = 50
var LFalse = LBool(false)
var LNil = LValue(&LNilType{})
var LTrue = LBool(true)
var LuaLDir string
var LuaOS string
var LuaPath = "LUA_PATH"
var LuaPathDefault string
var MaxArrayIndex = 67108864
var MaxTableGetLoop = 100
var RegistrySize = 256 * 20

func LVAsBool Uses

func LVAsBool(v LValue) bool

LVIsFalse returns false if a given LValue is a nil or false otherwise true.

func LVAsString Uses

func LVAsString(v LValue) string

LVAsString returns string representation of a given LValue if the LValue is a string or number, otherwise an empty string.

func LVCanConvToString Uses

func LVCanConvToString(v LValue) bool

LVCanConvToString returns true if a given LValue is a string or number otherwise false.

func LVIsFalse Uses

func LVIsFalse(v LValue) bool

LVIsFalse returns true if a given LValue is a nil or false otherwise false.

func OpenBase Uses

func OpenBase(L *LState) int

func OpenChannel Uses

func OpenChannel(L *LState) int

func OpenCoroutine Uses

func OpenCoroutine(L *LState) int

func OpenDebug Uses

func OpenDebug(L *LState) int

func OpenIo Uses

func OpenIo(L *LState) int

func OpenMath Uses

func OpenMath(L *LState) int

func OpenOs Uses

func OpenOs(L *LState) int

func OpenPackage Uses

func OpenPackage(L *LState) int

func OpenString Uses

func OpenString(L *LState) int

func OpenTable Uses

func OpenTable(L *LState) int

func UpvalueIndex Uses

func UpvalueIndex(i int) int

type ApiError Uses

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
}

func (*ApiError) Error Uses

func (e *ApiError) Error() string

type ApiErrorType Uses

type ApiErrorType int
const (
    ApiErrorSyntax ApiErrorType = iota
    ApiErrorFile
    ApiErrorRun
    ApiErrorError
    ApiErrorPanic
)

type CompileError Uses

type CompileError struct {
    Line    int
    Message string
    // contains filtered or unexported fields
}

func (*CompileError) Error Uses

func (e *CompileError) Error() string

type DbgCall Uses

type DbgCall struct {
    Name string
    Pc   int
}

type DbgLocalInfo Uses

type DbgLocalInfo struct {
    Name    string
    StartPc int
    EndPc   int
}

type Debug Uses

type Debug struct {
    Name            string
    What            string
    Source          string
    CurrentLine     int
    NUpvalues       int
    LineDefined     int
    LastLineDefined int
    // contains filtered or unexported fields
}

type FunctionProto Uses

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 Compile Uses

func Compile(chunk []ast.Stmt, name string) (proto *FunctionProto, err error)

func (*FunctionProto) String Uses

func (fp *FunctionProto) String() string

type Global Uses

type Global struct {
    MainThread    *LState
    CurrentThread *LState
    Registry      *LTable
    Global        *LTable
    // contains filtered or unexported fields
}

type LBool Uses

type LBool bool

func (LBool) String Uses

func (bl LBool) String() string

func (LBool) Type Uses

func (bl LBool) Type() LValueType

type LChannel Uses

type LChannel chan LValue

func (LChannel) String Uses

func (ch LChannel) String() string

func (LChannel) Type Uses

func (ch LChannel) Type() LValueType

type LFunction Uses

type LFunction struct {
    IsG       bool
    Env       *LTable
    Proto     *FunctionProto
    GFunction LGFunction
    Upvalues  []*Upvalue
}

func (*LFunction) LocalName Uses

func (fn *LFunction) LocalName(regno, pc int) (string, bool)

func (*LFunction) String Uses

func (fn *LFunction) String() string

func (*LFunction) Type Uses

func (fn *LFunction) Type() LValueType

type LGFunction Uses

type LGFunction func(*LState) int

type LNilType Uses

type LNilType struct{}

func (*LNilType) String Uses

func (nl *LNilType) String() string

func (*LNilType) Type Uses

func (nl *LNilType) Type() LValueType

type LNumber Uses

type LNumber float64

func LVAsNumber Uses

func LVAsNumber(v LValue) LNumber

LVAsNumber tries to convert a given LValue to a number.

func (LNumber) Format Uses

func (nm LNumber) Format(f fmt.State, c rune)

fmt.Formatter interface

func (LNumber) String Uses

func (nm LNumber) String() string

func (LNumber) Type Uses

func (nm LNumber) Type() LValueType

type LState Uses

type LState struct {
    G       *Global
    Parent  *LState
    Env     *LTable
    Panic   func(*LState)
    Dead    bool
    Options Options
    // contains filtered or unexported fields
}

func NewState Uses

func NewState(opts ...Options) *LState

func (*LState) ArgError Uses

func (ls *LState) ArgError(n int, message string)

func (*LState) Call Uses

func (ls *LState) Call(nargs, nret int)

func (*LState) CallByParam Uses

func (ls *LState) CallByParam(cp P, args ...LValue) error

func (*LState) CallMeta Uses

func (ls *LState) CallMeta(obj LValue, event string) LValue

func (*LState) CheckAny Uses

func (ls *LState) CheckAny(n int) LValue

func (*LState) CheckBool Uses

func (ls *LState) CheckBool(n int) bool

func (*LState) CheckChannel Uses

func (ls *LState) CheckChannel(n int) chan LValue

Checks whether the given index is an LChannel and returns this channel.

func (*LState) CheckFunction Uses

func (ls *LState) CheckFunction(n int) *LFunction

func (*LState) CheckInt Uses

func (ls *LState) CheckInt(n int) int

func (*LState) CheckInt64 Uses

func (ls *LState) CheckInt64(n int) int64

func (*LState) CheckNumber Uses

func (ls *LState) CheckNumber(n int) LNumber

func (*LState) CheckOption Uses

func (ls *LState) CheckOption(n int, options []string) int

func (*LState) CheckString Uses

func (ls *LState) CheckString(n int) string

func (*LState) CheckTable Uses

func (ls *LState) CheckTable(n int) *LTable

func (*LState) CheckThread Uses

func (ls *LState) CheckThread(n int) *LState

func (*LState) CheckType Uses

func (ls *LState) CheckType(n int, typ LValueType)

func (*LState) CheckTypes Uses

func (ls *LState) CheckTypes(n int, typs ...LValueType)

func (*LState) CheckUserData Uses

func (ls *LState) CheckUserData(n int) *LUserData

func (*LState) Close Uses

func (ls *LState) Close()

func (*LState) Concat Uses

func (ls *LState) Concat(values ...LValue) string

func (*LState) Context Uses

func (ls *LState) Context() context.Context

Context returns the LState's context. To change the context, use WithContext.

func (*LState) CreateTable Uses

func (ls *LState) CreateTable(acap, hcap int) *LTable

func (*LState) DoFile Uses

func (ls *LState) DoFile(path string) error

func (*LState) DoString Uses

func (ls *LState) DoString(source string) error

func (*LState) Equal Uses

func (ls *LState) Equal(lhs, rhs LValue) bool

func (*LState) Error Uses

func (ls *LState) Error(lv LValue, level int)

This function is equivalent to lua_error( http://www.lua.org/manual/5.1/manual.html#lua_error ).

func (*LState) FindTable Uses

func (ls *LState) FindTable(obj *LTable, n string, size int) LValue

func (*LState) ForEach Uses

func (ls *LState) ForEach(tb *LTable, cb func(LValue, LValue))

func (*LState) GPCall Uses

func (ls *LState) GPCall(fn LGFunction, data LValue) error

func (*LState) Get Uses

func (ls *LState) Get(idx int) LValue

func (*LState) GetFEnv Uses

func (ls *LState) GetFEnv(obj LValue) LValue

func (*LState) GetField Uses

func (ls *LState) GetField(obj LValue, skey string) LValue

func (*LState) GetGlobal Uses

func (ls *LState) GetGlobal(name string) LValue

func (*LState) GetInfo Uses

func (ls *LState) GetInfo(what string, dbg *Debug, fn LValue) (LValue, error)

func (*LState) GetLocal Uses

func (ls *LState) GetLocal(dbg *Debug, no int) (string, LValue)

func (*LState) GetMetaField Uses

func (ls *LState) GetMetaField(obj LValue, event string) LValue

func (*LState) GetMetatable Uses

func (ls *LState) GetMetatable(obj LValue) LValue

func (*LState) GetStack Uses

func (ls *LState) GetStack(level int) (*Debug, bool)

func (*LState) GetTable Uses

func (ls *LState) GetTable(obj LValue, key LValue) LValue

func (*LState) GetTop Uses

func (ls *LState) GetTop() int

func (*LState) GetTypeMetatable Uses

func (ls *LState) GetTypeMetatable(typ string) LValue

func (*LState) GetUpvalue Uses

func (ls *LState) GetUpvalue(fn *LFunction, no int) (string, LValue)

func (*LState) Insert Uses

func (ls *LState) Insert(value LValue, index int)

func (*LState) LessThan Uses

func (ls *LState) LessThan(lhs, rhs LValue) bool

func (*LState) Load Uses

func (ls *LState) Load(reader io.Reader, name string) (*LFunction, error)

func (*LState) LoadFile Uses

func (ls *LState) LoadFile(path string) (*LFunction, error)

func (*LState) LoadString Uses

func (ls *LState) LoadString(source string) (*LFunction, error)

func (*LState) NewClosure Uses

func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction

func (*LState) NewFunction Uses

func (ls *LState) NewFunction(fn LGFunction) *LFunction

func (*LState) NewTable Uses

func (ls *LState) NewTable() *LTable

func (*LState) NewThread Uses

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 Uses

func (ls *LState) NewTypeMetatable(typ string) *LTable

func (*LState) NewUserData Uses

func (ls *LState) NewUserData() *LUserData

func (*LState) Next Uses

func (ls *LState) Next(tb *LTable, key LValue) (LValue, LValue)

func (*LState) ObjLen Uses

func (ls *LState) ObjLen(v1 LValue) int

func (*LState) OpenLibs Uses

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) OptBool Uses

func (ls *LState) OptBool(n int, d bool) bool

func (*LState) OptChannel Uses

func (ls *LState) OptChannel(n int, ch chan LValue) chan LValue

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) OptFunction Uses

func (ls *LState) OptFunction(n int, d *LFunction) *LFunction

func (*LState) OptInt Uses

func (ls *LState) OptInt(n int, d int) int

func (*LState) OptInt64 Uses

func (ls *LState) OptInt64(n int, d int64) int64

func (*LState) OptNumber Uses

func (ls *LState) OptNumber(n int, d LNumber) LNumber

func (*LState) OptString Uses

func (ls *LState) OptString(n int, d string) string

func (*LState) OptTable Uses

func (ls *LState) OptTable(n int, d *LTable) *LTable

func (*LState) OptUserData Uses

func (ls *LState) OptUserData(n int, d *LUserData) *LUserData

func (*LState) PCall Uses

func (ls *LState) PCall(nargs, nret int, errfunc *LFunction) (err error)

func (*LState) Pop Uses

func (ls *LState) Pop(n int)

func (*LState) PreloadModule Uses

func (ls *LState) PreloadModule(name string, loader LGFunction)

Set a module loader to the package.preload table.

func (*LState) Push Uses

func (ls *LState) Push(value LValue)

func (*LState) RaiseError Uses

func (ls *LState) RaiseError(format string, args ...interface{})

This function is equivalent to luaL_error( http://www.lua.org/manual/5.1/manual.html#luaL_error ).

func (*LState) RawEqual Uses

func (ls *LState) RawEqual(lhs, rhs LValue) bool

func (*LState) RawGet Uses

func (ls *LState) RawGet(tb *LTable, key LValue) LValue

func (*LState) RawGetInt Uses

func (ls *LState) RawGetInt(tb *LTable, key int) LValue

func (*LState) RawSet Uses

func (ls *LState) RawSet(tb *LTable, key LValue, value LValue)

func (*LState) RawSetInt Uses

func (ls *LState) RawSetInt(tb *LTable, key int, value LValue)

func (*LState) Register Uses

func (ls *LState) Register(name string, fn LGFunction)

func (*LState) RegisterModule Uses

func (ls *LState) RegisterModule(name string, funcs map[string]LGFunction) LValue

func (*LState) Remove Uses

func (ls *LState) Remove(index int)

func (*LState) RemoveContext Uses

func (ls *LState) RemoveContext() context.Context

RemoveContext removes the context associated with this LState and returns this context.

func (*LState) Replace Uses

func (ls *LState) Replace(idx int, value LValue)

func (*LState) Resume Uses

func (ls *LState) Resume(th *LState, fn *LFunction, args ...LValue) (ResumeState, error, []LValue)

func (*LState) SetContext Uses

func (ls *LState) SetContext(ctx context.Context)

SetContext set a context ctx to this LState. The provided ctx must be non-nil.

func (*LState) SetFEnv Uses

func (ls *LState) SetFEnv(obj LValue, env LValue)

func (*LState) SetField Uses

func (ls *LState) SetField(obj LValue, key string, value LValue)

func (*LState) SetFuncs Uses

func (ls *LState) SetFuncs(tb *LTable, funcs map[string]LGFunction, upvalues ...LValue) *LTable

func (*LState) SetGlobal Uses

func (ls *LState) SetGlobal(name string, value LValue)

func (*LState) SetLocal Uses

func (ls *LState) SetLocal(dbg *Debug, no int, lv LValue) string

func (*LState) SetMetatable Uses

func (ls *LState) SetMetatable(obj LValue, mt LValue)

func (*LState) SetMx Uses

func (ls *LState) SetMx(mx int)

Set maximum memory size. This function can only be called from the main thread.

func (*LState) SetTable Uses

func (ls *LState) SetTable(obj LValue, key LValue, value LValue)

func (*LState) SetTop Uses

func (ls *LState) SetTop(idx int)

func (*LState) SetUpvalue Uses

func (ls *LState) SetUpvalue(fn *LFunction, no int, lv LValue) string

func (*LState) Status Uses

func (ls *LState) Status(th *LState) string

func (*LState) String Uses

func (ls *LState) String() string

func (*LState) ToBool Uses

func (ls *LState) ToBool(n int) bool

func (*LState) ToChannel Uses

func (ls *LState) ToChannel(n int) chan LValue

Converts the Lua value at the given acceptable index to the chan LValue.

func (*LState) ToFunction Uses

func (ls *LState) ToFunction(n int) *LFunction

func (*LState) ToInt Uses

func (ls *LState) ToInt(n int) int

func (*LState) ToInt64 Uses

func (ls *LState) ToInt64(n int) int64

func (*LState) ToNumber Uses

func (ls *LState) ToNumber(n int) LNumber

func (*LState) ToString Uses

func (ls *LState) ToString(n int) string

func (*LState) ToStringMeta Uses

func (ls *LState) ToStringMeta(lv LValue) LValue

ToStringMeta returns string representation of given LValue. This method calls the `__tostring` meta method if defined.

func (*LState) ToTable Uses

func (ls *LState) ToTable(n int) *LTable

func (*LState) ToThread Uses

func (ls *LState) ToThread(n int) *LState

func (*LState) ToUserData Uses

func (ls *LState) ToUserData(n int) *LUserData

func (*LState) Type Uses

func (ls *LState) Type() LValueType

func (*LState) TypeError Uses

func (ls *LState) TypeError(n int, typ LValueType)

func (*LState) Where Uses

func (ls *LState) Where(level int) string

func (*LState) XMoveTo Uses

func (ls *LState) XMoveTo(other *LState, n int)

func (*LState) Yield Uses

func (ls *LState) Yield(values ...LValue) int

type LString Uses

type LString string

func (LString) Format Uses

func (st LString) Format(f fmt.State, c rune)

fmt.Formatter interface

func (LString) String Uses

func (st LString) String() string

func (LString) Type Uses

func (st LString) Type() LValueType

type LTable Uses

type LTable struct {
    Metatable LValue
    // contains filtered or unexported fields
}

func (*LTable) Append Uses

func (tb *LTable) Append(value LValue)

Append appends a given LValue to this LTable.

func (*LTable) ForEach Uses

func (tb *LTable) ForEach(cb func(LValue, LValue))

ForEach iterates over this table of elements, yielding each in turn to a given function.

func (*LTable) Insert Uses

func (tb *LTable) Insert(i int, value LValue)

Insert inserts a given LValue at position `i` in this table.

func (*LTable) Len Uses

func (tb *LTable) Len() int

Len returns length of this LTable.

func (*LTable) MaxN Uses

func (tb *LTable) MaxN() int

MaxN returns a maximum number key that nil value does not exist before it.

func (*LTable) Next Uses

func (tb *LTable) Next(key LValue) (LValue, LValue)

This function is equivalent to lua_next ( http://www.lua.org/manual/5.1/manual.html#lua_next ).

func (*LTable) RawGet Uses

func (tb *LTable) RawGet(key LValue) LValue

RawGet returns an LValue associated with a given key without __index metamethod.

func (*LTable) RawGetH Uses

func (tb *LTable) RawGetH(key LValue) LValue

RawGet returns an LValue associated with a given key without __index metamethod.

func (*LTable) RawGetInt Uses

func (tb *LTable) RawGetInt(key int) LValue

RawGetInt returns an LValue at position `key` without __index metamethod.

func (*LTable) RawGetString Uses

func (tb *LTable) RawGetString(key string) LValue

RawGetString returns an LValue associated with a given key without __index metamethod.

func (*LTable) RawSet Uses

func (tb *LTable) RawSet(key LValue, value LValue)

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 Uses

func (tb *LTable) RawSetH(key LValue, value LValue)

RawSetH sets a given LValue to a given index without the __newindex metamethod.

func (*LTable) RawSetInt Uses

func (tb *LTable) RawSetInt(key int, value LValue)

RawSetInt sets a given LValue at a position `key` without the __newindex metamethod.

func (*LTable) RawSetString Uses

func (tb *LTable) RawSetString(key string, value LValue)

RawSetString sets a given LValue to a given string index without the __newindex metamethod.

func (*LTable) Remove Uses

func (tb *LTable) Remove(pos int) LValue

Remove removes from this table the element at a given position.

func (*LTable) String Uses

func (tb *LTable) String() string

func (*LTable) Type Uses

func (tb *LTable) Type() LValueType

type LUserData Uses

type LUserData struct {
    Value     interface{}
    Env       *LTable
    Metatable LValue
}

func (*LUserData) String Uses

func (ud *LUserData) String() string

func (*LUserData) Type Uses

func (ud *LUserData) Type() LValueType

type LValue Uses

type LValue interface {
    String() string
    Type() LValueType
    // contains filtered or unexported methods
}

type LValueType Uses

type LValueType int
const (
    LTNil LValueType = iota
    LTBool
    LTNumber
    LTString
    LTFunction
    LTUserData
    LTThread
    LTTable
    LTChannel
)

func (LValueType) String Uses

func (vt LValueType) String() string

type Options Uses

type Options struct {
    // Call stack size. This defaults to `lua.CallStackSize`.
    CallStackSize int
    // Data stack size. This defaults to `lua.RegistrySize`.
    RegistrySize 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
}

Options is a configuration that is used to create a new LState.

type P Uses

type P struct {
    Fn      LValue
    NRet    int
    Protect bool
    Handler *LFunction
}

type ResumeState Uses

type ResumeState int
const (
    ResumeOK ResumeState = iota
    ResumeYield
    ResumeError
)

type Upvalue Uses

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

func (*Upvalue) Close Uses

func (uv *Upvalue) Close()

func (*Upvalue) IsClosed Uses

func (uv *Upvalue) IsClosed() bool

func (*Upvalue) SetValue Uses

func (uv *Upvalue) SetValue(value LValue)

func (*Upvalue) Value Uses

func (uv *Upvalue) Value() LValue

Directories

PathSynopsis
ast
parse
pmLua pattern match functions for Go

Package lua imports 23 packages (graph) and is imported by 158 packages. Updated 2017-08-03. Refresh now. Tools for package owners.