RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorExport (glTF)Follow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track (Gymkhana Generator)Rectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot Creator (Vehicle Thumbnails)ShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files Syntaxutil/vehicleRopeDebug - Rope Physics Debug UIutil/worker - Batch Job Workerutil/wsTest - WebSocket Test Server

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)

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 Exports