RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorVehicle ExporterFollow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track GeneratorRectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot CreatorShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files SyntaxVehicle Rope DebugBatch WorkerWebSocket Test

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 ReferenceGE Extensionsutil

Sort Lines

Sorts JSONL (one-JSON-per-line) files alphabetically by their `name` field, primarily used for audio definition files.

Sorts JSONL (one-JSON-per-line) files alphabetically by their name field, primarily used for audio definition files.


Overview

util_sortLines reads files where each line is a JSON object, sorts them by the name field, and rewrites the file in sorted order. Provides a convenience function to process all JSON files in a level's Audio directory.

Module path: lua/ge/extensions/util/sortLines.lua Note: Plain module (no extension hooks), used via require or extensions.util_sortLines.


Exports (M)

FunctionSignatureDescription
handleFile(path)Reads a JSONL file, sorts lines by name, rewrites the file.
handleLevel(level)Processes all .json files in /levels/<level>/main/MissionGroup/Audio/.

Internals

Sorting

Each line is parsed via jsonDecode(line). Lines are sorted by obj.name (or "" if no name). Empty lines are discarded on rewrite.

File I/O

Uses readFile(path) to read, io.open(path, 'w') to rewrite. Each non-empty sorted line is written with a trailing newline.


How It Works

  1. Call handleFile(path) with a JSONL file path.
  2. Each line is decoded, paired with its name, and sorted alphabetically.
  3. The file is overwritten with sorted lines.

Lua Examples

local sortLines = extensions.util_sortLines

-- Sort a specific file
sortLines.handleFile('/levels/east_coast_usa/main/MissionGroup/Audio/sounds.json')

-- Sort all audio files for a level
sortLines.handleLevel('east_coast_usa')

Additional Exports

  • M.handleFile - (undocumented)
  • M.handleLevel - (undocumented)

See Also

  • Auto Annotation - Related reference
  • Booster - Related reference
  • Calibrate ESC - Related reference
  • Game Engine Overview - Guide

Showroom

Manages a simple showroom prefab for displaying vehicles in a clean environment.

Step Handler

A sequential step-execution system for orchestrating multi-step gameplay sequences (fades, vehicle spawns, level loads, waits, traffic).

On this page

OverviewExports (M)InternalsSortingFile I/OHow It WorksLua ExamplesAdditional ExportsSee Also