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

Loader Reference

Module defined in `lua/common/jbeam/loader.lua`. Main orchestrator for the JBeam vehicle loading pipeline. Coordinates all processing stages from file loading to 3D mesh attachment.

Module defined in lua/common/jbeam/loader.lua. Main orchestrator for the JBeam vehicle loading pipeline. Coordinates all processing stages from file loading to 3D mesh attachment.


Exports

Functions

M.loadVehicleStage1(objID, vehicleDir, vehicleConfig)

Entry point for vehicle loading. Runs on both vehicle and GE Lua. Normalizes directory paths, calls loadJbeam for the full processing pipeline, optionally writes debug files, then calls loadBundle for 3D object setup.

  • Parameters:
    • objID - number - Object ID of the vehicle being spawned
    • vehicleDir - string - Vehicle directory path (e.g. "/vehicles/pickup/")
    • vehicleConfig - table - Configuration with parts/partsTree, paints/colors, mainPartName, additionalVehicleData, etc.
  • Returns: self (module table, for chaining)

M.loadBundle(objID, vehicleBundle, loadingProgress)

Second stage: attaches 3D objects to the vehicle. Processes events, license plates, skins, colors, paints, initial node positions, ref nodes, flexbodies, props, visual ropes, materials, and mirrors. Requires the game engine (vehicleObj from scenetree).

  • Parameters:
    • objID - number - Object ID
    • vehicleBundle - table - Bundle from loadVehicleStage1
    • loadingProgress - object|nil - Loading progress reporter
  • Returns: nil

Variables

M.defaultBeamSpring

  • Type: number
  • Description: Default beam spring constant
  • Expected structure: 4300000

M.defaultBeamDeform

  • Type: number
  • Description: Default beam deformation threshold
  • Expected structure: 220000

M.defaultBeamDamp

  • Type: number
  • Description: Default beam damping value
  • Expected structure: 580

M.defaultNodeWeight

  • Type: number
  • Description: Default node weight in kg
  • Expected structure: 25

M.defaultBeamStrength

  • Type: number
  • Description: Default beam breaking strength
  • Expected structure: math.huge (infinite - beams don't break by default)

M.data

  • Type: table
  • Description: General-purpose data storage table
  • Expected structure: {} (empty by default)

M._noSerialize

  • Type: boolean
  • Description: Flag to prevent serialization of this module
  • Expected structure: true

Internal Notes

  • Loading pipeline order (inside loadJbeam):

    1. jbeamIO.startLoading - parse all .jbeam files
    2. jbeamSlotSystem.findParts - resolve part tree from config
    3. jbeamVariables.getAllVariables → processComponents → processParts - variable resolution
    4. jbeamSlotSystem.unifyPartJournal - merge parts together
    5. jbeamVariables.postProcessVariables + cleanup
    6. jbeamTableSchema.process - convert table schemas to objects
    7. sectionMerger.process - merge renamed sections
    8. jbeamLinks.prepareLinksDestructive - find cross-references
    9. jbeamOptimization.assignCIDs - assign continuous IDs
    10. jbeamLinks.resolveLinks - resolve references to CIDs
    11. jbeamNodeBeam.process - nodes/hydros/ropes/quads
    12. jbeamCamera.process - camera setup (GE only)
    13. jbeamWheels.processWheels - wheel construction
    14. jbeamLinks.resolveGroupLinks - group references
    15. jbeamAssorted.process, processRotators, jbeamGroups.process, jbeamScaling.process
    16. Default beam/node options applied
    17. jbeamOptimization.process - cleanup and dereference
    18. jbeamIO.finishLoading - clears some caches
    19. jbeamInteraction.process - input action loading
  • M.materials and M.materialsMap are loaded from particles.getMaterialsParticlesTable() at module load time.

  • Debug output controlled by -debugVehicleLoading command-line arg.

  • Runs on both GE and vehicle Lua; camera processing only happens on GE (vmType == 'game').

Links Reference

Module defined in `lua/common/jbeam/links.lua`. Resolves cross-references between JBeam sections (e.g. node name strings → CID integers), handling the `key:section` link syntax.

Materials Reference

Module defined in `lua/common/jbeam/materials.lua`. Processes material switches, glow maps, and deform group material bindings for vehicle 3D objects.

On this page

ExportsFunctionsM.loadVehicleStage1(objID, vehicleDir, vehicleConfig)M.loadBundle(objID, vehicleBundle, loadingProgress)VariablesM.defaultBeamSpringM.defaultBeamDeformM.defaultBeamDampM.defaultNodeWeightM.defaultBeamStrengthM.dataM._noSerializeInternal Notes