API ReferenceGE Extensionsflowgraphnodesmacro
Get Foreach (Flowgraph Node)
- **Node Name:** `Get Foreach`
Overview
- Node Name:
Get Foreach - Category:
provider - File:
extensions/flowgraph/nodes/macro/getForeach.lua
Retrieves the key and value for the current iteration when used inside a flowgraph spawned by a Foreach node.
Pin Schema
Input Pins
None.
Output Pins
| Pin | Type | Description |
|---|---|---|
key | string/id | The key of this element in the iterated table |
value | any | The value of this element in the iterated table |
Behavior
_executionStarted()- Readsself.mgr.modules.foreach.keyand.valueand writes them to the output pins. These values are set by the parentForeachnode before starting this flowgraph.
How It Works
This is the companion node to Foreach. When a Foreach node spawns a flowgraph for each table element, it injects the current key and value into the flowgraph manager's modules.foreach table. This node reads those values at execution start and exposes them as output pins.
The values are set once at execution start and don't change during the flowgraph's lifetime.
Example Usage
-- Inside a flowgraph loaded by Foreach:
-- [Get Foreach] → key (e.g., 1) and value (e.g., "vehicleData")
-- Use these outputs to drive per-element logic
-- Parent flowgraph:
-- table = {a = "alpha", b = "beta"}
-- Foreach spawns 2 instances:
-- Instance 1: key="a", value="alpha"
-- Instance 2: key="b", value="beta"Additional Methods
C:init(mgr, ...)
Initializes the node, setting up pins and default properties.
Parameters:
mgr...
C:postInit()
Called after initialization is complete for additional setup.
See Also
- Foreach (Flowgraph Node) - Related reference
- Integrated (Flowgraph Node) - Related reference
- I/O (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide