API ReferenceGE Extensionsflowgraphnodeslogic
XOR (Flowgraph Node)
- **Node Name:** `Xor`
Overview
- Node Name:
Xor - Category:
logic - File:
extensions/flowgraph/nodes/logic/xor.lua
Outputs flow only when exactly one of the two input pins has flow. A simple exclusive-or gate for flow signals.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
a | flow | First flow input |
b | flow | Second flow input |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Outflow - active when exactly one input has flow |
Behavior
work()- Sets output toa ~= b. If both are true or both are false, output is false.
How It Works
The node uses Lua's inequality operator (~=) on the two flow pin values. Since flow values are truthy/falsy, this effectively implements XOR: output is true only when exactly one input has flow.
Example Usage
-- Detect when only one of two conditions is met:
-- a = player is in vehicle
-- b = player is in building
-- flow = true only if in one but not both (or neither)
-- Truth table:
-- a=false, b=false → flow=false
-- a=true, b=false → flow=true
-- a=false, b=true → flow=true
-- a=true, b=true → flow=falseSee Also
- And (Flowgraph Node) - Related reference
- Boolean Expression (Flowgraph Node) - Related reference
- Branch (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide