pub fn module(lua: &Lua) -> Result<Table>Expand description
Register the flow module table with Lua.
v0.0.3 full impl — exposes:
flow.version(= string): crate versionflow.eval(node_table, ctx_table, dispatcher_fn) -> result_table: Lua-side entry to evaluate a flow.ir BluePrint with a Lua dispatcher fn
§Lua usage
local flow = require("flow") -- or set via lua.globals():set("flow", module(lua))
local node = {
kind = "step",
ref = "uppercase",
["in"] = { op = "path", at = "$.input" },
out = { op = "path", at = "$.output" },
}
local function dispatcher(ref, input)
if ref == "uppercase" then
return string.upper(input)
end
end
local result = flow.eval(node, { input = "hello" }, dispatcher)
assert(result.output == "HELLO")