Documentation
¶
Index ¶
- Constants
- Variables
- func BytesToLuaTable(L *lua.LState, data []byte) *lua.LTable
- func GoToLua(L *lua.LState, v interface{}) lua.LValue
- func IsLuaArray(table *lua.LTable) bool
- func LTableToMap(table *lua.LTable) map[string]interface{}
- func LTableToStringMap(table *lua.LTable) map[string]string
- func LuaTableToBytes(table *lua.LTable) []byte
- func LuaTableToSlice(table *lua.LTable) []interface{}
- func LuaToGo(value lua.LValue) interface{}
- func MapToLTable(L *lua.LState, m map[string]interface{}) *lua.LTable
- func PrepareMessageData(L *lua.LState, msg types.RuleMsg) lua.LValue
- func RegisterContextMethods(L *lua.LState, config types.Config, chainId string)
- func SliceToLTable(L *lua.LState, slice interface{}) *lua.LTable
- func StringMapToLTable(L *lua.LState, m map[string]string) *lua.LTable
- func ValidateLua(script string) error
- type LStatePool
Constants ¶
const LoadLuaLibs = "load_lua_libs"
LoadLuaLibs If config.Properties sets this key, then it means to load the built-in lua third-party tool library, otherwise do not load
Variables ¶
var Preloader = &preloader{}
Functions ¶
func BytesToLuaTable ¶ added in v0.32.0
BytesToLuaTable converts byte array to Lua table where each element is a byte value (0-255) Lua arrays are 1-indexed, so byte at index 0 in Go becomes index 1 in Lua
func IsLuaArray ¶ added in v0.32.0
IsLuaArray checks if a lua table is array-like
func LTableToMap ¶
LTableToMap converts a lua.LTable to a map[string]interface{}
func LTableToStringMap ¶
LTableToStringMap converts a lua.LTable to a map[string]string
func LuaTableToBytes ¶ added in v0.32.0
LuaTableToBytes converts Lua table (byte array) back to []byte Assumes the Lua table contains numeric values representing bytes (0-255)
func LuaTableToSlice ¶ added in v0.32.0
LuaTableToSlice converts a lua table to a slice
func MapToLTable ¶
MapToLTable converts a map to a lua.LTable
func PrepareMessageData ¶ added in v0.32.0
PrepareMessageData prepares message data for Lua processing based on the message data type This function handles the conversion from Go message data to appropriate Lua types: - JSON: Converts to Lua table (object or array) - BINARY: Converts to Lua table representing byte array - Others: Keeps as Lua string
func RegisterContextMethods ¶ added in v0.31.0
RegisterContextMethods 将全局缓存和链缓存功能注册到 Lua 状态中。 GlobalCache: 直接绑定到引擎的全局缓存。 ChainCache: 如果 config.Cache 和 chainId 不为空,则会根据 chainId 创建一个命名空间缓存实例,并将其作为 Lua 全局对象 ChainCache。否则 ChainCache 将为 nil。
func SliceToLTable ¶ added in v0.32.0
SliceToLTable converts a slice to a lua.LTable
func StringMapToLTable ¶
StringMapToLTable converts a map to a lua.LTable
Types ¶
type LStatePool ¶
type LStatePool struct {
// contains filtered or unexported fields
}
func NewFileLStatePool ¶
func NewFileLStatePool(config types.Config, path string, configuration types.Configuration) *LStatePool
func NewStringLStatePool ¶
func NewStringLStatePool(config types.Config, script string, configuration types.Configuration) *LStatePool
func (*LStatePool) Get ¶
func (pl *LStatePool) Get() *lua.LState
func (*LStatePool) New ¶
func (pl *LStatePool) New() *lua.LState
func (*LStatePool) Put ¶
func (pl *LStatePool) Put(L *lua.LState)
func (*LStatePool) Shutdown ¶
func (pl *LStatePool) Shutdown()