RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference
extensions/ - BeamNG Extension Modules
ui/imgui_api Referenceui/imgui_custom_luaintf Referenceui/imgui_gen_luaintf Referenceui/imgui Referenceui/imguiUtils Referenceui/imguiWire Referenceui/improfiler Reference

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 Referencecommonextensionsui

ui/imguiUtils Reference

Module defined in `lua/common/extensions/ui/imguiUtils.lua`. Higher-level ImGui widget utilities - dropdowns, key-value tables, recursive tree displays, texture objects, and sampled float displays.

Module defined in lua/common/extensions/ui/imguiUtils.lua. Higher-level ImGui widget utilities - dropdowns, key-value tables, recursive tree displays, texture objects, and sampled float displays.


Exports

Functions

M.changeUIScale(uiscale)

Change the ImGui UI scale factor.

  • Parameters:
    • uiscale - number - Scale multiplier
  • Returns: boolean - true on success

M.drawCursorPos(posX, posY)

Draw content at a specific cursor position.

  • Parameters:
    • posX - number - X cursor position
    • posY - number - Y cursor position
  • Returns: boolean

M.texObj(path)

Create or retrieve a cached texture object from a file path.

  • Parameters:
    • path - string - Image file path
  • Returns: table - Texture object

M.DropdownItem(label, icon, func, tooltip)

Create a dropdown menu item.

  • Parameters:
    • label - string - Item label
    • icon - string|nil - Icon identifier
    • func - function - Click callback
    • tooltip - string|nil - Hover tooltip

M.DropdownSelectableItem(label, active, func, tooltip)

Create a selectable dropdown item with active state.

  • Parameters:
    • label - string - Item label
    • active - boolean - Whether currently selected
    • func - function - Click callback
    • tooltip - string|nil - Hover tooltip

M.DropdownButton(label, size, items, icon, horizontal)

Create a dropdown button that opens a popup menu.

  • Parameters:
    • label - string - Button label
    • size - ImVec2 - Button size
    • items - table - Array of DropdownItem tables
    • icon - string|nil - Button icon
    • horizontal - boolean|nil - Horizontal layout
  • Returns: boolean - true if an item was clicked

M.DropdownSelectable(label, items, icon, iconSize, popupWidth, onChangeFunc, tooltip, itemsRMB)

Create a selectable dropdown with icon and popup.

  • Parameters:
    • label - string - Display label
    • items - table - Selectable items
    • icon - string|nil - Icon
    • iconSize - number|nil - Icon size
    • popupWidth - number|nil - Popup width
    • onChangeFunc - function|nil - Selection change callback
    • tooltip - string|nil - Tooltip
    • itemsRMB - table|nil - Right-click menu items
  • Returns: boolean

M.DropdownSelect(label, size, selectedItem, items, horizontal, excludeCurrent)

Dropdown select widget (combo box replacement).

  • Parameters:
    • label - string - Label
    • size - ImVec2 - Widget size
    • selectedItem - string - Currently selected item
    • items - table - Available items
    • horizontal - boolean|nil - Horizontal layout
    • excludeCurrent - boolean|nil - Hide current selection from list
  • Returns: boolean

M.IsWindowHovered(windowPos, windowSize)

Check if an ImGui window at the given position/size is hovered.

  • Parameters:
    • windowPos - ImVec2 - Window position
    • windowSize - ImVec2 - Window size
  • Returns: boolean

M.displayKeyValues(tbl)

Display a Lua table as key/value pairs in ImGui.

  • Parameters:
    • tbl - table - Data to display

M.CreateKeyValApp(window, section, tbl, callback)

Create a simple key/value display app from a Lua table.

  • Parameters:
    • window - string - Window name
    • section - string - Section name
    • tbl - table - Data table
    • callback - function|nil - Edit callback

M.keyValueTable(data, fullpath, highlightCallback, itemCallback)

Render a key-value table widget.

  • Parameters:
    • data - table - Data to display
    • fullpath - string - Current path prefix
    • highlightCallback - function|nil - Row highlight callback
    • itemCallback - function|nil - Item interaction callback

M.addRecursiveTreeTable(data, fullpath, noColumns, highlightCallback, itemCallback)

Render a recursive tree table widget for nested data.

  • Parameters:
    • data - table - Nested data to display
    • fullpath - string - Path prefix
    • noColumns - boolean|nil - Disable column headers
    • highlightCallback - function|nil - Highlight callback
    • itemCallback - function|nil - Item callback

M.cell(a, b)

Render a two-column table cell.

  • Parameters:
    • a - string - Left column value
    • b - string - Right column value

M.CreateSampleFloatDisplay(sampleTimeInSeconds, startingValue, precision)

Create a sampled float display object that averages values over time.

  • Parameters:
    • sampleTimeInSeconds - number - Sample window duration
    • startingValue - number - Initial display value
    • precision - number|nil - Decimal precision
  • Returns: table - Display object with :update(value) and :display() methods

M.SampleFloatDisplay(id, value, sampleTimeInSeconds, precision)

Stateless sampled float display - auto-creates/updates a display by ID.

  • Parameters:
    • id - string - Unique identifier
    • value - number - Current value
    • sampleTimeInSeconds - number - Sample window
    • precision - number|nil - Decimal precision

Variables

M.sampleFloatDisplayState

  • Type: table
  • Description: Internal state storage for SampleFloatDisplay instances (keyed by ID)

Internal Notes

  • Uses FFI for ImGui pointer types
  • newValueSampler creates time-windowed value averaging objects
  • pointToLine helper computes point-to-line distance for UI interaction
  • Sorted key iteration via getTableKeysSorted
  • Recursive tree rendering handles arbitrary nesting depth

ui/imgui Reference

Module defined in `lua/common/extensions/ui/imgui.lua`. ImGui context manager - initializes and maintains the Lua-side ImGui context linked to the C++ engine context.

ui/imguiWire Reference

Module defined in `lua/common/extensions/ui/imguiWire.lua`. ImGui wire protocol - serializes ImGui draw commands into a buffer for remote/deferred execution. Enables ImGui rendering across process bou

On this page

ExportsFunctionsM.changeUIScale(uiscale)M.drawCursorPos(posX, posY)M.texObj(path)M.DropdownItem(label, icon, func, tooltip)M.DropdownSelectableItem(label, active, func, tooltip)M.DropdownButton(label, size, items, icon, horizontal)M.DropdownSelectable(label, items, icon, iconSize, popupWidth, onChangeFunc, tooltip, itemsRMB)M.DropdownSelect(label, size, selectedItem, items, horizontal, excludeCurrent)M.IsWindowHovered(windowPos, windowSize)M.displayKeyValues(tbl)M.CreateKeyValApp(window, section, tbl, callback)M.keyValueTable(data, fullpath, highlightCallback, itemCallback)M.addRecursiveTreeTable(data, fullpath, noColumns, highlightCallback, itemCallback)M.cell(a, b)M.CreateSampleFloatDisplay(sampleTimeInSeconds, startingValue, precision)M.SampleFloatDisplay(id, value, sampleTimeInSeconds, precision)VariablesM.sampleFloatDisplayStateInternal Notes