API ReferenceGE Extensionsflowgraphnodeslogic
Edge Detector (Flowgraph Node)
- **Node Name:** `Edge Detector`
Overview
- Node Name:
Edge Detector - Category:
logic - File:
extensions/flowgraph/nodes/logic/edgeDetect.lua
Detects when an input signal changes value and outputs a single flow pulse. Supports numbers (with threshold), tables, and any other type.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Inflow for this node |
signal | any | Input signal to detect change in |
threshold | number | Threshold for numeric change detection (default: 0) |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Outputs flow when signal changes |
Legacy Pin Mapping
| Old Name | New Name |
|---|---|
_in.value | flow |
out.value | flow |
Behavior
work()- Compares the current signal against the last stored value. Change detection logic depends on type:- number: Uses
math.abs(current - last) > threshold - table: Compares element-by-element; uses threshold for numeric elements, equality for others. Also detects length changes.
- type mismatch: Always detects as changed
- other types: Simple inequality check (
~=)
- number: Uses
- Stores the current signal as
lastSignalfor the next frame.
How It Works
Each frame, the node compares the incoming signal to what it saw last frame. If the value has changed (beyond the optional threshold for numbers), it outputs flow for one frame. This is useful for triggering actions only when a value transitions, rather than continuously while a condition is true.
The middle of the node displays the last signal value for debugging.
Example Usage
-- Detect when gear changes:
-- signal = currentGear (number)
-- threshold = 0
-- Output flow fires once each time the gear shifts
-- Detect when a table of waypoints changes:
-- signal = waypointList (table)
-- threshold = 0.1 (for position tolerance)
-- Output flow fires when any waypoint moves beyond 0.1 unitsAdditional Methods
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
See Also
- And (Flowgraph Node) - Related reference
- Boolean Expression (Flowgraph Node) - Related reference
- Branch (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide