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.
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.
Exports
Functions
M.process(vehicle, processSlotsTable, omitWarnings)
Processes the entire vehicle data: moves non-table entries to vehicle.options, validates section names, then converts all list-type sections (with headers) into dict-type sections using processTableWithSchemaDestructive.
- Parameters:
vehicle- table - Raw vehicle data with mixed table/value entriesprocessSlotsTable- boolean|nil - If true, processes slots sections too (normally pre-processed by io module)omitWarnings- boolean|nil - Suppress warning logs
- Returns: boolean -
trueon success,falseon invalid attribute names
M.processTableWithSchemaDestructive(jbeamTable, newList, inputOptions, omitWarnings)
Converts a single JBeam table (array with header row + data rows) into a keyed dictionary. The first row is the header (column names). Subsequent rows become objects with header keys. Dict rows are treated as inline options that apply to following rows.
- Parameters:
jbeamTable- table - Array-format JBeam section[header, row1, row2, ...]newList- table - Output table to populateinputOptions- table|nil - Default options to apply to all rowsomitWarnings- boolean|nil - Suppress warnings
- Returns: number - Count of entries added, or
-1on error
Internal Notes
- Special value replacements (
replaceSpecialValues):FLT_MAX→math.huge,MINUS_FLT_MAX→-math.huge- Pipe-separated type flags:
"|HYDRO|NM_steel"→ bitwise OR of type IDs + material ID - Type IDs:
NORMAL=0,HYDRO=6,ANISOTROPIC=1,TIRESIDE=1(alias for ANISOTROPIC),BOUNDED=2,PRESSURED=3,SUPPORT=7,LBEAM=4,FIXED=1,NONCOLLIDABLE=2, plus light flags (SIGNAL_LEFT=1,SIGNAL_RIGHT=2,HEADLIGHT=4,BRAKELIGHT=8,RUNNINGLIGHT=16,REVERSELIGHT=32)
- Rows with
disable = true(orvariables.disable = true) are skipped. - If a row has an
idfield, it becomes the key in the output dict; otherwise sequential counter is used. - Inline options (dict rows interspersed with data) accumulate and apply to all subsequent rows.
- Supports CSV include:
{"include": "path.csv", "delimiter": ","}loads and injects rows. - Attribute names must match
^[a-zA-Z_]+[a-zA-Z0-9_]*$. - Sections in
jbeamUtils.ignoreSectionsare skipped.
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).
Utils Reference
Module defined in `lua/common/jbeam/utils.lua`. Provides low-level construction utilities for adding nodes, beams, and rotators to vehicle data, plus node transform operations (rotate/offset/move).