RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Ambient SoundUI Apps ManagerUI AudioBindings LegendCamera Distance AppDeveloper ConsoleCredits MusicExternal WebSocket ServerFade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsNavigation Map DataVehicle Paint EditorVehicle Vicinity AppUI Visibility
Details InteractionVehicle SelectorTile ClusteringTile GroupingTilesTile SortingVehicle OperationsVehicle 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

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

See Also

  • Vehicle Selector – Details Interaction - Related reference
  • Vehicle Selector – General - Related reference
  • Vehicle Selector – Tile Clustering - Related reference
  • UI System Guide - Guide

Tiles

Generates the grouped, clustered, and sorted tile grid for the 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 ExportsSee Also