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

SlotSystem Reference

Module defined in `lua/common/jbeam/slotSystem.lua`. Resolves the vehicle part tree from configuration, handling slot matching, part selection, and part unification (merging).

Module defined in lua/common/jbeam/slotSystem.lua. Resolves the vehicle part tree from configuration, handling slot matching, part selection, and part unification (merging).


Exports

Functions

M.partFitsSlot(part, slot)

Checks if a part is compatible with a slot definition, supporting both slots v1 (type) and v2 (allowTypes/denyTypes).

  • Parameters:
    • part - table - Part data with slotType (string or table of strings)
    • slot - table - Slot definition with type (v1) or allowTypes/denyTypes (v2)
  • Returns: boolean, string - false and error message on failure

M.findParts(ioCtx, vehicleConfig)

Recursively resolves the entire part tree from vehicle configuration. Starting from the main part, walks all slots, selects parts (from user config or defaults), and builds both a hierarchical tree and flat maps.

  • Parameters:
    • ioCtx - table - IO context from jbeamIO.startLoading
    • vehicleConfig - table - Vehicle configuration with mainPartName and either parts (flat map) or partsTree (hierarchical dict)
  • Returns: table, table, table, table, table, table, table - rootPart, unifyJournal, unifyJournalC, chosenPartsTree, slotPartMap, activePartsData, activeParts
    • rootPart - table - The main part data
    • unifyJournal - table - Array of merge operations (post-order)
    • unifyJournalC - table - Array of merge operations (pre-order, for components)
    • chosenPartsTree - table - Hierarchical tree of chosen parts with slot metadata
    • slotPartMap - table - {slotPath → partName}
    • activePartsData - table - {partName → deepcopy of part data}
    • activeParts - table - {partPath → partName}

M.unifyPartJournal(ioCtx, unifyJournal)

Replays the unify journal to merge all chosen parts into the root part. Each journal entry triggers unifyParts which merges sections from child parts into the parent.

  • Parameters:
    • ioCtx - table - IO context
    • unifyJournal - table - Journal from findParts
  • Returns: boolean - true on success

Internal Notes

  • partFitsSlot v1 quirk: For slots v1, when part.slotType is a table, the check uses not tableContains - meaning it returns true when the slot type is NOT in the table. This appears to be a bug in the game code but is the actual runtime behavior.
  • Part selection priority: (1) user-specified part from config, (2) slot default, (3) empty.
  • unifyParts handles three merge cases per section:
    • New section: direct assignment with slot options injected
    • Existing table section: appends rows with slot options, handles $+/$*/$</$> merge modifiers for numeric values
    • Basic data: overwrites (except slotType and partName)
  • chosenPartsTree entries have: id, path, chosenPartName, partPath, children, suitablePartNames, unsuitablePartNames, decisionMethod
  • decisionMethod values: "user", "user-empty", "default", "default-empty"
  • Recursion limit: 50 levels deep.
  • Uses an ordered table implementation (newT) for deterministic iteration.

SectionMerger Reference

Module defined in `lua/common/jbeam/sectionMerger.lua`. Merges duplicate/aliased JBeam sections together for backward compatibility (e.g. `triggers2` → `triggers`).

TableSchema Reference

Module defined in `lua/common/jbeam/tableSchema.lua`. Converts JBeam table-format data (header row + data rows) into keyed object dictionaries, applying options and special value replacements.

On this page

ExportsFunctionsM.partFitsSlot(part, slot)M.findParts(ioCtx, vehicleConfig)M.unifyPartJournal(ioCtx, unifyJournal)Internal Notes