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

Boolean Expression (Flowgraph Node)

- **Node Name:** `Boolean Expression`

Overview

  • Node Name: Boolean Expression
  • Category: simple
  • File: extensions/flowgraph/nodes/logic/booleanExpression.lua

Evaluates a user-defined boolean expression using input pin values as variables. Supports template expressions (AND, OR, XOR, NAND) and custom expressions.

Pin Schema

Input Pins

PinTypeDescription
aboolA term of the expression
bboolA term of the expression

Additional input pins are auto-created when links are added (named c, d, etc.).

Output Pins

PinTypeDescription
valueboolThe result of the calculation

Data Properties

PropertyTypeDefaultDescription
expressionstring""The boolean expression to evaluate
safeModebooltrueIf true, skips evaluation when any active input is nil

Template Expressions

NameExpressionDescription
ANDa and bTrue if both a and b are true
ORa or bTrue if either a or b is true
XOR(a and not b) or (b and not a)True if exactly one is true
NANDnot (a and b)True if a and b are not both true

Behavior

  • init() - Sets up safe mode, empty expression, builds the sandboxed environment, and initializes caches.
  • work() - In safe mode, skips if any connected input is nil. Parses the expression on first use or change, then evaluates via pcall. Sets value output to the result.
  • parseExpression() - Validates the expression string (no assignments, only boolean keywords), then loads it in a sandboxed environment using load().
  • buildBaseEnv() - Creates a Lua environment with a metatable that reads pin input values by name.
  • onLink(link) - Auto-creates a new boolean input pin when all existing pins are connected.
  • _executionStarted() - Builds the list of pins that have active links for safe mode checking.

How It Works

The node dynamically compiles a Lua boolean expression string into a function. Pin values are exposed as variables (a, b, c, ...) through a metatable-based environment. The expression is only re-parsed when it changes, and execution is wrapped in pcall for safety.

Example Usage

-- In a flowgraph: set expression to "a and b"
-- Connect two boolean sources to pins a and b
-- Output "value" will be true only when both inputs are true

-- Custom expression with 3 inputs:
-- expression = "a or (b and not c)"
-- Automatically creates pin c when linked

Additional Methods

C:_onDeserialized(nodeData)

Called after the node is deserialized (loaded from file). Restores runtime state from saved data.

Parameters:

  • nodeData

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

C:onUnlink(link)

Called when a pin is unlinked from another node.

Parameters:

  • link

See Also

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

And (Flowgraph Node)

- **Node Name:** `And`

Branch (Flowgraph Node)

- **Node Name:** `Branch`

On this page

OverviewPin SchemaInput PinsOutput PinsData PropertiesTemplate ExpressionsBehaviorHow It WorksExample UsageAdditional MethodsC:_onDeserialized(nodeData)C:drawCustomProperties()C:drawMiddle(builder, style)C:onUnlink(link)See Also