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
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility
Vehicle Selector – Details InteractionVehicle Selector – GeneralVehicle Selector – Tile ClusteringVehicle Selector – Tile GroupingVehicle Selector – TilesVehicle Selector – Tile SortingVehicle Selector – Vehicle OperationsVehicle Selector – Vehicle Specifications

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 ExtensionsuivehicleSelector

Vehicle Selector – Tile Sorting

Sorting functions for vehicle selector tiles by various criteria.

Sorting functions for vehicle selector tiles by various criteria.


Overview

ui_vehicleSelector_tileSorting provides comparator functions for sorting vehicle tiles by name, value, weight, power, speed, acceleration, and config type. Used by the tiles module to order items within groups.

Extension path: lua/ge/extensions/ui/vehicleSelector/tileSorting.lua


Exports (M)

FunctionSignatureDescription
getSortFunction(sortMode) → fnReturns the comparator for the given mode.
sortTiles(tiles, sortMode)Sorts a tile array in-place.
sortGroup(group, sortMode)Sorts group.tiles in-place.
sortByNameButOtherAlwaysLast(a, b) → boolName sort, "Other..." always last.
sortByValue(a, b) → boolSort by Value.
sortByYears(a, b) → boolSort by Years.
sortByConfigTypeName(a, b) → boolSort by config type order.

Internals

Sort Modes

ModeSorts ByDirection
NameName (alpha)A→Z, "Other..." last
ValuePriceLow→High
YearsYearOld→New
WeightWeightLight→Heavy
Top SpeedTop speedSlow→Fast
PowerPowerLow→High
Weight/PowerWeight÷Power ratioBest→Worst
0-60 mph0-60 timeBest→Worst (reversed)
0-100 km/h0-100 timeBest→Worst (reversed)
Config TypePredefined orderFactory→Other

Config Type Order

Factory(1) → Service(2) → Race(3) → Drift(4) → Rally(5)
→ Police(6) → Custom(7) → Powerglow(8) → Other(9)

Tie-Breaking

All sort functions fall back to sortByNameButOtherAlwaysLast on equal values, with "Other..." items always sorted last.


How It Works

  1. The tiles module calls sortTiles(tiles, sortMode) after building tiles for a group.
  2. getSortFunction looks up the comparator from the sortFunctions table.
  3. table.sort is called with the comparator.

Lua Examples

local tileSorting = require('/lua/ge/extensions/ui/vehicleSelector/tileSorting')

-- Sort tiles by value
tileSorting.sortTiles(myTiles, "Value")

-- Get comparator for custom sorting
local cmp = tileSorting.getSortFunction("Power")
table.sort(myList, cmp)

Additional Exports

The following exports are available but not yet documented in detail:

  • M.getSortFunction
  • M.sortByConfigTypeName
  • M.sortByNameButOtherAlwaysLast
  • M.sortByValue
  • M.sortByYears
  • M.sortGroup
  • M.sortTiles

Vehicle Selector – Tiles

Generates the grouped, clustered, and sorted tile grid for the vehicle selector.

Vehicle Selector – Vehicle Operations

Handles vehicle spawning, replacing, cloning, and management actions in the vehicle selector.

On this page

OverviewExports (M)InternalsSort ModesConfig Type OrderTie-BreakingHow It WorksLua ExamplesAdditional Exports