api

package
v0.0.0-...-40ef3ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LUA_MAXINTEGER = 1<<63 - 1
	LUA_MININTEGER = -1 << 63
)
View Source
const (
	LUA_TNONE = iota - 1 // -1
	LUA_TNIL
	LUA_TBOOLEAN
	LUA_TLIGHTUSERDATA
	LUA_TNUMBER
	LUA_TSTRING
	LUA_TTABLE
	LUA_TFUNCTION
	LUA_TUSERDATA
	LUA_TTHREAD
)

basic types

View Source
const (
	LUA_OPADD  = iota // +
	LUA_OPSUB         // -
	LUA_OPMUL         // *
	LUA_OPMOD         // %
	LUA_OPPOW         // ^
	LUA_OPDIV         // /
	LUA_OPIDIV        // //
	LUA_OPBAND        // &
	LUA_OPBOR         // |
	LUA_OPBXOR        // ~
	LUA_OPSHL         // <<
	LUA_OPSHR         // >>
	LUA_OPUNM         // -
	LUA_OPBNOT        // ~
)

arithmetic functions

View Source
const (
	LUA_OPEQ = iota // ==
	LUA_OPLT        // <
	LUA_OPLE        // <=
)

comparison functions

View Source
const (
	LUA_OK = iota
	LUA_YIELD
	LUA_ERRRUN
	LUA_ERRSYNTAX
	LUA_ERRMEM
	LUA_ERRGCMM
	LUA_ERRERR
	LUA_ERRFILE
)

thread status

View Source
const LUAI_MAXSTACK = 1000000
View Source
const LUA_MINSTACK = 20
View Source
const LUA_MULTRET = -1
View Source
const LUA_REGISTRYINDEX = -LUAI_MAXSTACK - 1000
View Source
const LUA_RIDX_GLOBALS int64 = 2
View Source
const LUA_RIDX_MAINTHREAD int64 = 1

Variables

This section is empty.

Functions

func LuaUpvalueIndex

func LuaUpvalueIndex(i int) int

Types

type ArithOp

type ArithOp = int

type AuxLib

type AuxLib interface {
	/* Error-report functions */
	Error2(fmt string, a ...interface{}) int
	ArgError(arg int, extraMsg string) int
	/* Argument check functions */
	CheckStack2(sz int, msg string)
	ArgCheck(cond bool, arg int, extraMsg string)
	CheckAny(arg int)
	CheckType(arg int, t LuaType)
	CheckInteger(arg int) int64
	CheckNumber(arg int) float64
	CheckString(arg int) string
	OptInteger(arg int, d int64) int64
	OptNumber(arg int, d float64) float64
	OptString(arg int, d string) string
	/* Load functions */
	DoFile(filename string) bool
	DoString(str string) bool
	LoadFile(filename string) int
	LoadFileX(filename, mode string) int
	LoadString(s string) int
	/* Other functions */
	TypeName2(idx int) string
	ToString2(idx int) string
	Len2(idx int) int64
	GetSubTable(idx int, fname string) bool
	GetMetafield(obj int, e string) LuaType
	CallMeta(obj int, e string) bool
	OpenLibs()
	RequireF(modname string, openf GoFunction, glb bool)
	NewLib(l FuncReg)
	NewLibTable(l FuncReg)
	SetFuncs(l FuncReg, nup int)
}

auxiliary library

type BasicAPI

type BasicAPI interface {
	/* basic stack manipulation */
	GetTop() int
	AbsIndex(idx int) int
	CheckStack(n int) bool
	Pop(n int)
	Copy(fromIdx, toIdx int)
	PushValue(idx int)
	Replace(idx int)
	Insert(idx int)
	Remove(idx int)
	Rotate(idx, n int)
	SetTop(idx int)
	XMove(to LuaState, n int)
	/* access functions (stack -> Go) */
	TypeName(tp LuaType) string
	Type(idx int) LuaType
	IsNone(idx int) bool
	IsNil(idx int) bool
	IsNoneOrNil(idx int) bool
	IsBoolean(idx int) bool
	IsInteger(idx int) bool
	IsNumber(idx int) bool
	IsString(idx int) bool
	IsTable(idx int) bool
	IsThread(idx int) bool
	IsFunction(idx int) bool
	IsGoFunction(idx int) bool
	ToBoolean(idx int) bool
	ToInteger(idx int) int64
	ToIntegerX(idx int) (int64, bool)
	ToNumber(idx int) float64
	ToNumberX(idx int) (float64, bool)
	ToString(idx int) string
	ToStringX(idx int) (string, bool)
	ToGoFunction(idx int) GoFunction
	ToThread(idx int) LuaState
	ToPointer(idx int) interface{}
	RawLen(idx int) uint
	/* push functions (Go -> stack) */
	PushNil()
	PushBoolean(b bool)
	PushInteger(n int64)
	PushNumber(n float64)
	PushString(s string)
	PushFString(fmt string, a ...interface{})
	PushGoFunction(f GoFunction)
	PushGoClosure(f GoFunction, n int)
	PushGlobalTable()
	PushThread() bool
	/* Comparison and arithmetic functions */
	Arith(op ArithOp)
	Compare(idx1, idx2 int, op CompareOp) bool
	RawEqual(idx1, idx2 int) bool
	/* get functions (Lua -> stack) */
	NewTable()
	CreateTable(nArr, nRec int)
	GetTable(idx int) LuaType
	GetField(idx int, k string) LuaType
	GetI(idx int, i int64) LuaType
	RawGet(idx int) LuaType
	RawGetI(idx int, i int64) LuaType
	GetMetatable(idx int) bool
	GetGlobal(name string) LuaType
	/* set functions (stack -> Lua) */
	SetTable(idx int)
	SetField(idx int, k string)
	SetI(idx int, i int64)
	RawSet(idx int)
	RawSetI(idx int, i int64)
	SetMetatable(idx int)
	SetGlobal(name string)
	Register(name string, f GoFunction)
	/* 'load' and 'call' functions (load and run Lua code) */
	Load(chunk []byte, chunkName, mode string) int
	Call(nArgs, nResults int)
	PCall(nArgs, nResults, msgh int) int
	/* miscellaneous functions */
	Len(idx int)
	Concat(n int)
	Next(idx int) bool
	Error() int
	StringToNumber(s string) bool
	/* coroutine functions */
	NewThread() LuaState
	Resume(from LuaState, nArgs int) int
	Yield(nResults int) int
	Status() int
	IsYieldable() bool
	GetStack() bool // debug
}

type CompareOp

type CompareOp = int

type FuncReg

type FuncReg map[string]GoFunction

type GoFunction

type GoFunction func(LuaState) int

type LuaState

type LuaState interface {
	BasicAPI
	AuxLib
}

type LuaType

type LuaType = int

type LuaVM

type LuaVM interface {
	LuaState
	PC() int
	AddPC(n int)
	Fetch() uint32
	GetConst(idx int)
	GetRK(rk int)
	RegisterCount() int
	LoadVararg(n int)
	LoadProto(idx int)
	CloseUpvalues(a int)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL