Documentation ¶
Index ¶
Constants ¶
View Source
const ( TNIL = C.LUA_TNIL TBOOLEAN = C.LUA_TBOOLEAN TNUMBER = C.LUA_TNUMBER TSTRING = C.LUA_TSTRING TTABLE = C.LUA_TTABLE TFUNCTION = C.LUA_TFUNCTION )
View Source
const ( AttrMapSet = 1 << 0 AttrMapGet = 1 << 1 )
View Source
const (
//限制map元素数量
MapSizeLimit = 16
)
Variables ¶
View Source
var (
ErrStepLimit = errors.New("run step arraive limit")
)
Functions ¶
func NewMapContext ¶
Types ¶
type ILuaState ¶
type ILuaState interface { //设置当前步数 SetStep(step int) //关闭状态机 Close() //打开所有标准库 OpenLibs() //加载执行脚本 Exec(script []byte) error //检测脚本语法错误 Check(script []byte) (err error) //获取环境 Context() context.Context //注册全局函数,函数不能引用其他go指针数据 SetFunc(name string, fn LuaFunc) ILuaState //设置执行步限制 SetLimit(limit int) ILuaState //获取当前执行步数 GetStep() int //global SetGlobal(name string) ILuaState SetGlobalValue(name string, v interface{}) ILuaState GetGlobal(name string) int GetTop() int SetTop(idx int) Pop(idx int) //get stack GetType(idx int) int ToStr(idx int) string ToInt(idx int) int64 ToFloat(idx int) float64 ToBool(idx int) bool ToFunc(idx int) LuaFunc ToValue(idx int) interface{} IsStr(idx int) bool IsInt(idx int) bool IsFloat(idx int) bool IsBool(idx int) bool IsTable(idx int) bool IsFunc(idx int) bool //push stack PushNil() PushValue(v interface{}) PushStr(v string) PushInt(v int64) PushFloat(v float64) PushBool(v bool) PushFunc(fn LuaFunc) //table NewTable() ITable //each top stack table ForEach(fn func() bool) //是否是数组,并返回长度 IsArray(idx int) (int, bool) Next(idx int) int TableLen(idx int) int SetTable(idx int) SetField(idx int, key string) GetTable(idx int) int GetField(idx int, key string) int //作为对象设置table值 SetValue(idx int, k string, v interface{}) GetValue(idx int, k string) interface{} //做为数组设置table值 SetArray(idx int, k int, v interface{}) GetArray(idx int, k int) interface{} //对idx位置的table操作 ToTable(idx int) ITable }
Click to show internal directories.
Click to hide internal directories.