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
Button ModuleDisplay Data ModuleFilter ModuleTiles ModuleTranslate Helper

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 ExtensionsuigridSelectorUtils

Tiles Module

Generic tile processing framework for grid selectors - provides path routing, grouping, clustering, and special group handling.

Generic tile processing framework for grid selectors - provides path routing, grouping, clustering, and special group handling.


Overview

tilesModule is a configurable tile processing factory used by grid selector backends. It provides a framework for path-based navigation, context creation with utility functions, and hooks for extensibility.

Module path: lua/ge/extensions/ui/gridSelectorUtils/tilesModule.lua (loaded via require)


Exports (M)

FunctionSignatureDescription
create(config)Creates a tiles processing instance.

Config Options

KeyTypeDescription
itemToTileConverterfunctionConverts raw items to tile format.
pathHandlerstableMap of path type → handler function.
clusteringFunctionfunctionGroups items into clusters.
groupingModulemoduleProvides group mode functions.
sortingModulemoduleProvides sort functions.
getDataFunctionfunctionReturns current UI data.
filterFunctionfunctionTests if items pass filters.
backendNamestringBackend identifier.

Instance Methods

MethodSignatureDescription
getTiles(path, pathChanged?, overrideDefault?, tileFuncs?)Main entry - routes to path handler.
createContext(data, overrideDefault?, tileFuncs?)Creates a context object with utilities.

Internals

Context Object

The context bundles configuration and utility functions for path handlers:

local context = {
  itemToTileConverter = ...,
  filterFunction = ...,
  sortingModule = ...,
  groupingModule = ...,

  -- Utility functions
  finalizeGroups = function(groups, favGroup, recentGroup) ... end,
  setDefaultSelection = function(group, model) ... end,
  matchesGroup = function(config, groupMode, groupName) ... end,
  processClusteredItems = function(clustered, group, clusterMode) ... end,
  handleSpecialGroups = function(tile, favGroup, recentGroup) ... end,

  profiler = p,
  data = data,
}

Finalize Groups

Limits recent group to 15 tiles, filters empty groups, and sorts groups by order then name.

Default Selection

Finds the default-selected tile in a group. Priority:

  1. Content-specific default (e.g., model.default_pc)
  2. Override tile (e.g., from navigation context)
  3. Fallback to last tile in the group

Special Group Handling

Duplicates tiles into Favourites/Recent groups based on display mode:

if data.displayData.showFavouritesMode == 'completeClusters' and tile.favouriteIdx > 0 then
  local favouriteTile = deepcopy(tile)
  favouriteTile.key = favouriteTile.key .. "_" .. tile.favouriteIdx
  table.insert(favouriteGroup.tiles, favouriteTile)
end

Path Dispatch

local handler = pathHandlers[pathType]
if handler then
  local result = handler(path, data, context)
  if pathChanged then
    extensions.hook("onGridSelectorGetTiles", backendName, pathType)
  end
  return result
end

How It Works

  1. Backend creates instance with tilesModule.create({pathHandlers = {...}, ...})
  2. UI calls instance.getTiles(path) with a navigation path
  3. A context is created with all utilities and current data
  4. Path type dispatches to the registered handler
  5. Handler uses context utilities for filtering, grouping, sorting
  6. Result is a list of groups with tiles for the grid UI

Additional Exports

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

  • M.create

See Also

  • Button Module - Related reference
  • Display Data Module - Related reference
  • Filter Module - Related reference
  • UI System Guide - Guide

Filter Module

Reusable filtering system for grid selectors - supports set filters, range filters, search text, filter locking, and active filter calculation.

Translate Helper

Translation utility with caching and nested translation pattern resolution.

On this page

OverviewExports (M)Config OptionsInstance MethodsInternalsContext ObjectFinalize GroupsDefault SelectionSpecial Group HandlingPath DispatchHow It WorksAdditional ExportsSee Also