lua

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const FunctionNameTransform = "Transform"

FunctionNameTransform is the name of the function to be called in the script

Variables

This section is empty.

Functions

This section is empty.

Types

type LuaTransform

type LuaTransform struct {
	Config LuaTransformConfiguration
	// contains filtered or unexported fields
}

LuaTransform is a component that transforms messages based on Lua scripts

func (*LuaTransform) Destroy

func (x *LuaTransform) Destroy()

Destroy releases the resources of the component

func (*LuaTransform) Init

func (x *LuaTransform) Init(ruleConfig types.Config, configuration types.Configuration) error

Init initializes the component

func (*LuaTransform) New

func (x *LuaTransform) New() types.Node

New creates a new instance of LuaFilter

func (*LuaTransform) OnMsg

func (x *LuaTransform) OnMsg(ctx types.RuleContext, msg types.RuleMsg)

OnMsg handles the message

func (*LuaTransform) Type

func (x *LuaTransform) Type() string

Type returns the type of the component

type LuaTransformConfiguration

type LuaTransformConfiguration struct {
	//Script configures the function body content or the script file path with `.lua` as the suffix
	//Only need to provide the function body content, if it is a file path, then need to provide the complete script function:
	//function Transform(msg, metadata, msgType, dataType) ${Script} \n end
	//return msg, metadata, msgType
	//The parameter msg, if the data type of msg is JSON, then it will be converted to the Lua table type before calling the function
	//If the data type of msg is BINARY, then it will be converted to a Lua table (byte array) before calling the function
	Script string
}

LuaTransformConfiguration node configuration

Jump to

Keyboard shortcuts

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