API ReferenceGE Extensionsflowgraphnodesmath
Accumulator (Flowgraph Node)
- **Node Name:** `Accumulator`
Overview
- Node Name:
Accumulator - Category:
repeat_instant - File:
extensions/flowgraph/nodes/math/accumulator.lua
Adds together values whenever triggered. Maintains a running sum that can be reset back to a default value.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
add | flow | Triggering this pin adds the value pin's amount to the internal sum |
reset | flow (impulse) | Resets the internal sum back to the default reset value |
value | number | Value to add to the stack (default is 1) |
Output Pins
| Pin | Type | Description |
|---|---|---|
changed | flow (impulse) | Fires when the internal value has changed |
result | number | The current accumulated sum |
Internals
| Field | Purpose |
|---|---|
self.data.currentSum | Running total of accumulated values |
self.data.resetValue | Value to reset to (default 0) |
How It Works
- On execution start,
currentSumis set toresetValueand output is updated. - Each frame, if
resetis triggered, the sum resets toresetValue(reset has priority over add). - If
addis triggered, the inputvalue(or 1 if nil) is added to the sum, andchangedfires. - On execution stop or deserialization,
currentSumresets toresetValue.
The node displays the current sum in its middle area via ImGui.
Lua Example
-- Flowgraph usage: counting laps
-- Connect a trigger zone's "entered" flow → add pin
-- value pin = 1 (default)
-- result pin → UI display showing lap count
-- reset flow → connected to race restartKey Dependencies
ui_imgui- for rendering the current value in the node editor_flowgraph_createNode()- standard flowgraph node registration
Additional Methods
C:_executionStarted()
Called when graph execution starts. Used for initialization/reset.
C:_executionStopped()
Called when graph execution stops. Used for cleanup.
C:_onDeserialized()
Called after the node is deserialized (loaded from file). Restores runtime state from saved data.
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
C:init()
Initializes the node, setting up pins and default properties.
C:work()
Main work function called each frame/tick when the node is active.
See Also
- Ease (Flowgraph Node) - Related reference
- Increaser (Flowgraph Node) - Related reference
- Expression (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide