FLUXLIXDocs

Functions and Macros

Functions and macros let you extract repeated workflow logic into a named, reusable piece that can be called from any workflow in the same project.

Functions

A function is a self-contained sub-graph with defined inputs and outputs. When a workflow calls a function node, execution steps into the sub-graph, runs through it, and then returns with the output values.

Creating a function

  1. Open the Functions panel from the workflow editor sidebar.
  2. Click New Function and give it a name.
  3. The editor switches to the function's canvas. Add a Function Input node to declare what parameters the function accepts, and a Function Output node to declare what it returns.
  4. Build the logic between those two nodes as you would any other workflow.

Calling a function

Drag the function from the Functions panel onto your workflow canvas. It appears as a node with the input and output handles you defined. Connect it into your graph like any other node.

Functions can call other functions, but circular references are not allowed.

Macros

A macro works like a function but is expanded inline at run time rather than called as a separate sub-graph. The nodes from the macro are effectively inserted into the parent workflow at the point where the macro node appears.

Macros are best for small, frequently repeated snippets where you want the logic to be part of the parent flow rather than isolated. If the logic is more than a few nodes or needs to be tested independently, prefer a function.

Creating a macro

The process is the same as creating a function. In the Functions panel, choose New Macro instead. Macros also use Function Input and Function Output nodes to define their interface.

When to use each

FunctionMacro
Has its own isolated scopeYesNo
Can be tested independentlyYesNo
Expanded inlineNoYes
Good for complex reusable logicYesNo
Good for short repeated snippetsNoYes