API ReferenceGE Extensionsflowgraphnodeslogic
And (Flowgraph Node)
- **Node Name:** `And`
Overview
- Node Name:
And - Category:
logic - File:
extensions/flowgraph/nodes/logic/and.lua - Icon:
fg_gate_icon_and
Only lets flow through if all input pins receive flow. Supports a configurable number of inputs.
Pin Schema
Input Pins (default 2, configurable)
| Pin | Type | Description |
|---|---|---|
flow_1 | flow | First flow input |
flow_2 | flow | Second flow input |
flow_N | flow | Nth flow input (added via properties) |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Outflow - active only when all inputs receive flow |
Legacy Pin Names
a→flow_1b→flow_2
Internals
self.count- number of input flow pins (default 2, configurable via editor UI).drawCustomProperties()provides an integer input to add/remove flow pins dynamically.updatePins(old, new)- adds or removes pins. When removing, also deletes connected links.- Serializes/deserializes the
countvalue. - On deserialization, calls
updatePins(2, count)to restore extra pins beyond the default 2.
How It Works
- Each frame, iterates over all
flow_1throughflow_Ninput pins. - If any pin is
false/nil, outputsflow = falseand returns early. - Only if all pins are truthy does it output
flow = true.
Lua Code Example
-- Logical AND in a flowgraph context:
-- Connect multiple flow sources to flow_1, flow_2, flow_3...
-- Output flow only activates when ALL inputs are active.
-- Equivalent logic:
local allActive = true
for i = 1, count do
if not flowInputs[i] then
allActive = false
break
end
endKey Dependencies
- None - pure logic node with no external dependencies
Additional Methods
C:_onDeserialized(res)
Called after the node is deserialized (loaded from file). Restores runtime state from saved data.
Parameters:
res
C:_onSerialize(res)
Called when the node is serialized (saved to file). Returns data to persist.
Parameters:
res
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
- Boolean Expression (Flowgraph Node) - Related reference
- Branch (Flowgraph Node) - Related reference
- Bundle (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide