stack

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: GPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrJSNotFindFile :
	ErrJSNotFindFile = errors.New("script file does not exist")
	// ErrJSNotFileData :
	ErrJSNotFileData = errors.New("did not get file data")
)

Functions

This section is empty.

Types

type JSStack

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

JSStack doc @Struct JSStack @Summary javascirpt virtual machine

func MakeJSStack

func MakeJSStack() *JSStack

MakeJSStack doc @Method MakeJSStack @Summary create javascript virtual machine

func (*JSStack) ExecuteScriptFile

func (slf *JSStack) ExecuteScriptFile(filename string) (otto.Value, error)

ExecuteScriptFile doc @Method ExecuteScriptFile @Summary Execution script file @Param (string) scirpt file path @Return (otto.Value) javascript result @Return (error) javascript execution error result

func (*JSStack) SetBoolean

func (slf *JSStack) SetBoolean(name string, val bool)

SetBoolean doc @Method SetBoolean @Summary Set Bool variables for JS scripts @Param (string) name @Param (bool) value

func (*JSStack) SetDouble

func (slf *JSStack) SetDouble(name string, val float64)

SetDouble doc @Method SetDouble @Summary Set the Float 64 variable to the JS script @Param (string) name @Param (float64) value

func (*JSStack) SetFloat

func (slf *JSStack) SetFloat(name string, val float32)

SetFloat doc @Method SetFloat @Summary Set the Float 32 variable to the JS script @Param (string) name @Param (float32) value

func (*JSStack) SetFunc

func (slf *JSStack) SetFunc(name string, fun interface{})

SetFunc doc @Method SetFunc @Summary Set the js script to call Go's function @Param (string) name @Param (interface{}) value

func (*JSStack) SetInt

func (slf *JSStack) SetInt(name string, val int)

SetInt doc @Method SetInt @Summary Set the Int variable to the JS script @Param (string) name @Param (int) value

func (*JSStack) SetString

func (slf *JSStack) SetString(name string, val string)

SetString doc @Method SetString @Summary Set String variables for JS scripts @Param (string) name @Param (string) value

type LuaStack

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

LuaStack : LUA虚拟机 堆

func NewLuaStack

func NewLuaStack() *LuaStack

NewLuaStack create a lua stack

func (*LuaStack) AddLuaLoader

func (slf *LuaStack) AddLuaLoader(f *mlua.LuaGoFunction)

AddLuaLoader : LUA载入器

func (*LuaStack) AddSreachPath

func (slf *LuaStack) AddSreachPath(path string)

AddSreachPath : 添加LUA搜索路径

func (*LuaStack) Clean

func (slf *LuaStack) Clean()

Clean : 清空堆栈

func (*LuaStack) ExecuteFunction

func (slf *LuaStack) ExecuteFunction(numArgs int) (int, error)

ExecuteFunction : 执行LUA 函数

func (*LuaStack) ExecuteScriptFile

func (slf *LuaStack) ExecuteScriptFile(fileName string) (int, error)

ExecuteScriptFile : 执行LUA脚本文件

func (*LuaStack) ExecuteString

func (slf *LuaStack) ExecuteString(codes string) (int, error)

ExecuteString : 执行LUA字符串

func (*LuaStack) GetLuaState

func (slf *LuaStack) GetLuaState() *mlua.State

GetLuaState Get LUA virtual machine C object

func (*LuaStack) OpenLibs

func (slf *LuaStack) OpenLibs()

OpenLibs library

func (*LuaStack) PushBoolean

func (slf *LuaStack) PushBoolean(boolValue bool)

PushBoolean : 插入 bool

func (*LuaStack) PushDouble

func (slf *LuaStack) PushDouble(doubleValue float64)

PushDouble : 插入 float64

func (*LuaStack) PushFloat

func (slf *LuaStack) PushFloat(floatValue float32)

PushFloat : 插入 float

func (*LuaStack) PushInt

func (slf *LuaStack) PushInt(intValue int)

PushInt : 插入Int

func (*LuaStack) PushLong

func (slf *LuaStack) PushLong(longValue int64)

PushLong : 插入64位Int

func (*LuaStack) PushNil

func (slf *LuaStack) PushNil()

PushNil : 插入一个 Nil

func (*LuaStack) PushString

func (slf *LuaStack) PushString(stringValue string)

PushString : 插入字符串

func (*LuaStack) ReLoad

func (slf *LuaStack) ReLoad(moduleFileName string) (int, error)

ReLoad : 重新载入

func (*LuaStack) Register

func (slf *LuaStack) Register(f mlua.LuaGoFunction, name string, args ...interface{})

Register : 注册闭包函数

func (*LuaStack) Shutdown

func (slf *LuaStack) Shutdown()

Shutdown Close lua_state

Jump to

Keyboard shortcuts

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