RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
And (Flowgraph Node)Boolean Expression (Flowgraph Node)Branch (Flowgraph Node)Bundle (Flowgraph Node)Chainflow Branch (Flowgraph Node)Compare (Flowgraph Node)Edge Detector (Flowgraph Node)Flow Switch (Flowgraph Node)Frame Delay (Flowgraph Node)Once (Flowgraph Node)Flow Interval / Rate Limit (Flowgraph Node)Select (Flowgraph Node)Sequencer (Flowgraph Node)Switch Case (Flowgraph Node)Timed Trigger (Flowgraph Node)Wait (Flowgraph Node)XOR (Flowgraph Node)

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodeslogic

Compare (Flowgraph Node)

- **Node Name:** `Compare`

Overview

  • Node Name: Compare
  • Category: logic
  • File: extensions/flowgraph/nodes/logic/compare.lua

Compares two values using a selectable comparison operator (==, ~=, <, >, <=, >=) and outputs the boolean result along with flow routing.

Pin Schema

Input Pins

PinTypeDescription
flowflowInflow for this node
AanyFirst value for comparison
BanySecond value for comparison

Output Pins

PinTypeDescription
flowflowOutflow for this node
trueflowFlow when comparison returns true
falseflowFlow when comparison returns false
valueboolThe boolean result of the comparison (hidden)

Data Properties

The comparison operator is selected via a dropdown in the node's custom properties UI, using getComparisonOps().

Behavior

  • init() - Sorts available comparison operators and selects the first one as default.
  • work() - Compares A and B using the selected operator. For <, >, <=, >=: if either operand is nil, logs an error and outputs false. For ==/~=: nil operands are allowed.
  • refreshFunction() - Updates the comparison function reference when the operator changes.
  • _onSerialize(res) / _onDeserialized(res) - Persists the selected operator symbol.

How It Works

The node uses getComparisonOps() to get a table of comparison functions with their symbols. The selected function is called on each work() tick with the two input values. The result routes flow to either the true or false output pin.

The middle of the node displays the current operator symbol (e.g., ==, >).

Example Usage

-- Compare player speed against a threshold:
-- A = currentSpeed (number)
-- B = 50 (hardcoded number)
-- Operator: >=
-- Result: true flow if speed >= 50

-- Equivalent Lua:
local result = (A >= B)
if result then
  -- true branch
else
  -- false branch
end

Additional Methods

C:_onPropertyChanged(key, val)

Called when a node property is changed in the editor.

Parameters:

  • key
  • val

C:drawCustomProperties()

Custom ImGui drawing for the node's properties panel in the editor.

C:drawMiddle(builder, style)

Custom ImGui drawing in the middle section of the node in the editor.

Parameters:

  • builder
  • style

See Also

  • And (Flowgraph Node) - Related reference
  • Boolean Expression (Flowgraph Node) - Related reference
  • Branch (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Chainflow Branch (Flowgraph Node)

- **Node Name:** `Chainflow Branch`

Edge Detector (Flowgraph Node)

- **Node Name:** `Edge Detector`

On this page

OverviewPin SchemaInput PinsOutput PinsData PropertiesBehaviorHow It WorksExample UsageAdditional MethodsC:_onPropertyChanged(key, val)C:drawCustomProperties()C:drawMiddle(builder, style)See Also