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

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 Extensionsflowgraph

Flowgraph Variable Storage

Class-based storage for flowgraph variables. Manages typed variables with merge strategies, serialization, custom ordering, and per-graph node updates.

Class-based storage for flowgraph variables. Manages typed variables with merge strategies, serialization, custom ordering, and per-graph node updates.


Public API (Class Methods)

MethodSignatureReturnsDescription
C:init(mgr)nilInitializes storage with manager reference and supported types
C:getName()stringReturns "(mgrName / mgrId)" identifier
C:getTypes()tableReturns list of supported variable types
C:getMergeStrats(type)tableReturns available merge strategies for a type
C:variableExists(name)booleanChecks if a variable exists
C:get(name)value, booleanGets variable value; second return is false if nonexistent
C:getFull(name)table, booleanGets full variable data table
C:clear()nilRemoves all variables and changes
C:addVariable(name, value, type, mergeStrat, fixedType, undeletable)booleanAdds a new variable; false if already exists
C:removeVariable(name)booleanRemoves a variable; false if nonexistent or undeletable
C:renameVariable(name, newName)booleanRenames variable and updates graph nodes
C:updateType(name, type)booleanChanges variable type; resets value to type default
C:changeBase(name, value)booleanSets both base and current value
C:changeInstant(name, value)booleanSets current value only (no merge)
C:change(name, value)booleanMerges value using the variable's merge strategy
C:finalizeChanges()nilFinalizes all pending merge changes
C:setMergeStrat(name, strat)booleanSets merge strategy for a variable
C:setFixedType(name, fixedType)booleanLocks/unlocks type changes
C:setMonitor(name, monitor)booleanEnables/disables monitoring
C:setKeepAfterStop(name, keep)booleanKeeps value across execution stops
C:changeCustomVariableOrder(name, newIdx)nilReorders a variable in custom sort order

Supported Types

string, number, bool, vec3, quat, color

Internals

  • Merge strategies: Variables use merge functions (e.g., last, max, or_) to combine multiple writes per frame
  • Custom ordering: customVariableOrder tracks display order; sortedVariableNames is index-sorted
  • Node updates: Renaming or type-changing a variable propagates to all getVariable/setVariable nodes in graphs and macros
  • Execution lifecycle: _executionStopped resets non-keepAfterStop variables to base values

How It Works

  1. Variables are stored in self.variables[name] with baseValue, value, type, mergeStrat, etc.
  2. During execution, change() calls the variable's merge function; changes accumulate in variableChanges
  3. finalizeChanges() resolves all pending merges and re-initializes merge state
  4. On stop, variables reset to their base value unless keepAfterStop is set

Usage Examples

-- Create a variable storage (done internally by flowgraph manager)
local storage = require('/lua/ge/extensions/flowgraph/variableStorage')(manager)

-- Add variables
storage:addVariable("score", 0, "number", "max")
storage:addVariable("playerName", "unknown", "string", "last", true) -- fixedType

-- Read/write
local val, exists = storage:get("score")
storage:change("score", 50)
storage:finalizeChanges()

-- Rename
storage:renameVariable("score", "totalScore")

-- Serialize for save
local data = storage:_onSerialize()

Notes

  • Returns a factory function, not an extension module - instantiated per flowgraph manager
  • Default merge strategies: last for strings, max for numbers, or_ for bools
  • Type changes reset values to sensible defaults (0, false, {0,0,0}, etc.)

Additional Exports

refreshSortedVariableNames()

getMaxSortIndex()


See Also

  • Flowgraph Base Module - Related reference
  • Flowgraph Base State Node - Related reference
  • Flowgraph Base Node - Related reference
  • FlowGraph Guide - Guide

Flowgraph Utils

Utility functions for the flowgraph system.

Flowgraph Action Module

Manages input action filtering for flowgraph projects. Allows nodes to block or allow specific player input actions during flowgraph execution (e.g., disabling certain controls during a mission cutsce

On this page

Public API (Class Methods)Supported TypesInternalsHow It WorksUsage ExamplesNotesAdditional ExportsrefreshSortedVariableNames()getMaxSortIndex()See Also