RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference
ExpressionParser ReferenceGroups ReferenceInteraction ReferenceIO ReferenceLinks ReferenceLoader ReferenceMaterials ReferenceOptimization ReferenceScaling ReferenceSectionMerger ReferenceSlotSystem ReferenceTableSchema ReferenceUtils ReferenceVariables Reference

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 Referencecommonjbeam

ExpressionParser Reference

Module defined in `lua/common/jbeam/expressionParser.lua`. Parses and evaluates `$=` expressions in JBeam data, providing a sandboxed math environment with variable substitution.

Module defined in lua/common/jbeam/expressionParser.lua. Parses and evaluates $= expressions in JBeam data, providing a sandboxed math environment with variable substitution.


Exports

Functions

M.parseSafe(expr, vars)

Safely parses and evaluates a $= expression string. Strips the $= prefix, substitutes $ with var_ for Lua compatibility, validates no assignments exist, then evaluates in a sandboxed context. Catches errors via pcall.

  • Parameters:
    • expr - string - Expression string starting with $= (e.g. "$=someVar * 2")
    • vars - table - Variable lookup table keyed by $name, values can be numbers or tables with .val field
  • Returns: function - Compiled expression function

M.parse(expr, vars)

Parses and evaluates a $= expression without error protection (no pcall). Faster than parseSafe but will throw on errors.

  • Parameters:
    • expr - string - Expression string starting with $=
    • vars - table - Variable lookup table keyed by $name
  • Returns: any - Evaluated result (throws on error)

M.compileSafe(expr)

Compiles a $= expression into a reusable function without evaluating it. Creates an isolated context with its own variable wrapper so compiled functions can be re-evaluated with different variables.

  • Parameters:
    • expr - string - Expression string starting with $=
  • Returns: self (module table, for chaining)

Internal Notes

  • The sandbox context includes: round, square, clamp, smoothstep, smootherstep, smoothmin, sign, case, vec3, quat, concat, include, print, and all math.* functions.
  • The case(selector, ...) helper acts as a ternary for booleans or an n-way selector for integers.
  • include(resourceURI, sheetName, cellRef) supports loading external .csv and .xlsx files into expressions.
  • The $ character in expressions is rewritten to var_ prefix for Lua variable names. The metatable on context handles $variable lookups.
  • Assignment detection: single = not preceded by <, >, ~, or = triggers an error to prevent code injection.
  • Lazy-loads csvlib and xlsxlib on first use.

ui/flowgraph/editor Reference

Module defined in `lua/common/extensions/ui/flowgraph/editor.lua`. Flowgraph visual scripting editor API - type system, node categories, variable editors, vehicle selectors, and display utilities.

Groups Reference

Module defined in `lua/common/jbeam/groups.lua`. Processes group arrays on JBeam rows, converting group name lists into indexed lookup tables and assigning group IDs.

On this page

ExportsFunctionsM.parseSafe(expr, vars)M.parse(expr, vars)M.compileSafe(expr)Internal Notes