jbeamWriter Reference
Module defined in `lua/common/jbeamWriter.lua`. A specialized JSON pretty-printer for jbeam files that formats objects with indentation up to a configurable depth, then falls back to compact encoding
Module defined in lua/common/jbeamWriter.lua. A specialized JSON pretty-printer for jbeam files that formats objects with indentation up to a configurable depth, then falls back to compact encoding for deeper levels.
Exports
Functions
M.writeFile(filename, obj)
Writes a Lua table to a file as pretty-printed jbeam JSON with depth-limited formatting (max level 2).
- Parameters:
filename- string - Output file pathobj- table - Data to serialize
- Returns: boolean - True on success, false on failure
Internal Notes
- Uses
jsonEncodePrettyJbeam(v, lvl, numberPrecision, maxLevel)internally - When
lvl > maxLevel, falls back to compactjsonEncode(v)for deeper structures - The
componentssection at level 1 always gets full pretty-printing (maxLevel = 999) - Handles special cases:
inf→9e999,vec3andquatcdata types → JSON objects - String escaping handles backslashes, newlines, tabs, quotes, carriage returns
- Numbers use
%.10gformat by default, or fixed-precision whennumberPrecisionis specified
introspection Reference
Module defined in `lua/common/introspection.lua`. Gathers method information from all globally registered classes and built-in modules for runtime reflection.
json-ast Reference
Module defined in `lua/common/json-ast.lua`. A JSON/jbeam AST (Abstract Syntax Tree) parser that preserves formatting, comments, and whitespace. Used by the in-game jbeam editor for lossless round-tri