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

Button Module

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

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


Overview

buttonModule provides a factory (create()) that produces button management instances. Each instance tracks registered buttons with auto-incrementing IDs and executes callbacks when buttons are clicked in the grid selector detail panel.

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


Exports (M)

FunctionSignatureDescription
create()Creates and returns a new button manager instance.

Instance Methods

MethodSignatureDescription
addButton(callback, meta)Registers a button, returns meta with buttonId.
executeButton(buttonId, additionalData?)Calls the callback for the given button ID.
clearButtonFunctions()Clears all registered buttons.
getButtonInfo(buttonId)Returns {callback, meta} for a button.
getAllButtonInfos()Returns all registered button infos.

Internals

Button Registration

Each addButton call assigns an auto-incrementing ID and stores the callback:

local function addButton(callback, meta)
  local buttonId = getFreeButtonId()
  meta = meta or {}
  meta.buttonId = buttonId
  buttonsInfos[buttonId] = { callback = callback, meta = meta }
  return meta
end

Typical Usage

Tile generators register buttons when building detail panels:

local buttonInstance = require("ge/extensions/ui/gridSelectorUtils/buttonModule").create()

-- In a detail handler:
table.insert(data.buttonInfo,
  buttonInstance.addButton(function()
    backend.trackRecent(itemDetails.key)
    gameplay_missions_missionManager.startWithLoadingLevel(mission)
  end, {
    label = "Start Mission",
    icon = "play",
    primary = true,
    isDoubleClickAction = true,
  })
)

-- When UI clicks the button:
buttonInstance.executeButton(buttonId)

Meta Properties

Common meta fields used by the UI:

  • label - button text
  • icon - icon identifier
  • primary - highlighted as main action
  • isDoubleClickAction - triggered on tile double-click
  • waitForLoadingScreen - shows loading screen after click

How It Works

  1. Backend creates a button instance via buttonModule.create()
  2. Detail panel handlers register buttons with addButton(callback, meta)
  3. UI renders buttons using the returned meta (label, icon, primary)
  4. User clicks → UI calls executeButton(buttonId)
  5. The stored callback fires, performing the action (start mission, etc.)

Additional Exports

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

  • M.create

Scenario Tiles Generator

Tile generator for legacy scenario entries in the gameplay selector grid.

Display Data Module

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

On this page

OverviewExports (M)Instance MethodsInternalsButton RegistrationTypical UsageMeta PropertiesHow It WorksAdditional Exports