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

Display Data Module

Persistent display settings, favourites, and recent items manager for grid selectors.

Persistent display settings, favourites, and recent items manager for grid selectors.


Overview

displayDataModule provides a factory that creates instances managing display preferences (group mode, sort order, tile size), favourite tracking, and recent item history. Data is persisted to a JSON file.

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


Exports (M)

FunctionSignatureDescription
create(dataFile, options, updateFn, backendName, targetVersion)Creates a display data manager instance.

Instance Methods

MethodSignatureDescription
getDisplayData()Returns current display settings (lazy-initialized).
setDisplayDataOption(key, value)Updates a setting and persists to disk.
resetDisplayDataToDefaults()Resets all saveable options to defaults.
getDisplayDataOptions()Returns option definitions with current values for UI.
toggleFavourite(itemKey)Toggles favourite status (stores timestamp).
isFavourite(itemKey)Returns timestamp if favourited, nil otherwise.
isRecentItem(itemKey)Returns index in recent list, or false.
trackRecentItem(itemKey)Adds/moves item to front of recent list.
clearAllFavourites()Clears all favourites.
clearAllRecentItems()Clears recent item history.

Internals

Persistence

Data is saved to a JSON file (e.g., /settings/gameplaySelectorData.json):

local data = {
  favourites = favourites,         -- {itemKey: timestamp}
  recentItems = recentItems,       -- ordered list of keys
  version = currentVersion,
  displayData = displayData        -- {groupMode: "system", ...}
}
jsonWriteFile(dataFile, data, true, nil, true)

Version Migration

An updateDisplayDataFunction callback handles migrations when saved data is older:

if data.version < currentVersion then
  data.displayData = updateDisplayDataFunction(data.displayData, data.version, currentVersion)
end

Option Types

Options support dropdown, checkbox, and number types. Options with settingsKey sync to engine settings. Special handling:

  • showAuxContent defaults based on shipping_build
  • showCareerContent respects shipping status

Recent Items

Recent items are stored as an ordered list (LIFO), capped at 100:

local function trackRecentItem(itemKey)
  local idx = arrayFindValueIndex(recentItems, itemKey)
  if idx then table.remove(recentItems, idx) end
  table.insert(recentItems, 1, itemKey)
  while #recentItems > maxRecentItems do
    table.remove(recentItems, #recentItems)
  end
end

How It Works

  1. Backend creates instance: displayDataModule.create("/settings/data.json", options, migrateFn, "mySelector", 11)
  2. First getDisplayData() loads from disk, applies defaults, handles migrations
  3. UI reads options via getDisplayDataOptions() for rendering controls
  4. Setting changes call setDisplayDataOption(key, value) → persist + hook
  5. Favourites/recents are tracked alongside display data in the same file

Additional Exports

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

  • M.create

Button Module

Factory module for managing detail panel buttons with callback registration and execution by ID.

Filter Module

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

On this page

OverviewExports (M)Instance MethodsInternalsPersistenceVersion MigrationOption TypesRecent ItemsHow It WorksAdditional Exports