Astarte.Flow.Blocks.LuaMapper (astarte_flow v0.1.0)

This is a map block that takes an incoming Message and it transforms it using given Lua script. This block supports Lua 5.3 scripts. The incoming message will be provided to the script as message

Link to this section Summary

Functions

Executes the Lua script and returns the new message created using the script.

Starts the LuaMapper.

Link to this section Functions

Link to this function

lua_map(msg, config)

@spec lua_map(Astarte.Flow.Message.t(), Astarte.Flow.Blocks.LuaMapper.Config.t()) ::
  {:ok, Astarte.Flow.Message.t()} | {:error, reason :: term()}

Executes the Lua script and returns the new message created using the script.

Link to this function

start_link(opts)

@spec start_link([Astarte.Flow.Blocks.LuaMapper.Config.option()]) ::
  GenServer.on_start()

Starts the LuaMapper.

options

Options

  • :script - a Lua 5.3 script. Defaults to "return message;".