API ReferenceGE ExtensionseditorvehicleEditorstaticEditor
Vehicle Editor - JBeam Variables Checker
Validates that JBeam variable values (both defaults and vehicle configuration overrides) fall within their declared min/max ranges across all vehicle directories.
Validates that JBeam variable values (both defaults and vehicle configuration overrides) fall within their declared min/max ranges across all vehicle directories.
Module Exports
| Export | Type | Description |
|---|---|---|
M.menuEntry | string | "JBeam Variables Checker" - menu label |
M.open | function | Opens the checker window |
M.onUpdate | hook | Renders ImGui window with analysis button |
M.onSerialize | hook | Persists window state |
M.onDeserialized | hook | Restores window state |
How It Works
analyze()scans each vehicle directory undervehicles/- For each directory:
- Loads all
.pc(part config) files and extracts variable overrides - Builds a mapping:
varName -> [{pcFilePath, val}, ...]
- Loads all
- For each
.jbeamfile, processesvariablessections viajbeamTableSchema checkValInRange()validates:- The variable's default value against its own min/max
- Each config file's override value against the variable's min/max
- Logs warnings for out-of-range values with file locations
Lua Code Example
-- Open the variables checker
extensions.editor_vehicleEditor_staticEditor_veJBeamVariablesChecker.open()
-- Click "Start Analysis" - results print to console
-- "Results get printed to the console."
-- Analysis flow per vehicle directory:
-- local dirPaths = FS:findFiles('vehicles', "*", 0, false, true)
-- for _, vehDir in ipairs(dirPaths) do
-- local pcFilePaths = FS:findFiles(vehDir, "*.pc", -1, false, false)
-- local jbeamFilePaths = FS:findFiles(vehDir, "*.jbeam", -1, false, false)
-- ...
-- end
-- Config override extraction:
-- local vehConfig = extensions.core_vehicle_partmgmt.buildConfigFromString(vehDir, pcFilePath)
-- if vehConfig.vars then
-- for var, val in pairs(vehConfig.vars) do
-- varToConfigsAndVals[var] = varToConfigsAndVals[var] or {}
-- table.insert(varToConfigsAndVals[var], {pcFilePath = pcFilePath, val = val})
-- end
-- end
-- Range validation with clamping:
-- vv.min, vv.max = math.min(vv.min, vv.max), math.max(vv.min, vv.max)
-- local valBeforeClamp = vv.val
-- vv.val = clamp(vv.val, vv.min, vv.max)
-- if valBeforeClamp ~= vv.val then
-- log('W', '', 'variable $spring_rate value out of range! value 50000 clamped to [1000, 40000]')
-- log('W', '', ' var defined: vehicles/car/car.jbeam:car_part')
-- log('W', '', ' val defined: vehicles/car/sport.pc')
-- end
-- Uses jbeamTableSchema to process variable definitions:
-- jbeamTableSchema.process(partData, false, true)See Also
- Vehicle Editor - JBeam Beautifier - Related reference
- Vehicle Editor - JBeam Modifier Leaking Visualizer - Related reference
- Vehicle Editor - JBeam Spellchecker - Related reference
- World Editor Guide - Guide
Vehicle Editor - JBeam Table Visualizer
Visualizes numeric table data from JBeam files as interactive 2D plots with Catmull-Rom curve interpolation, useful for inspecting torque curves, gear ratios, and other tabular data.
Vehicle Editor - Part List
Sortable, searchable table listing all available (or active-only) JBeam parts for the current vehicle, with file modification timestamps and part selection.