RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Debug DrawingGPU Mesh StructsImGui FFIMath Structs (FFI)FFI C DefinitionsPID ControllersCSV LibraryDelay LineDequeDevelopment UtilitiesEvent ReferenceExtension SystemSignal FiltersGraph PathfindingUI BridgeInput Filter Constants2D Bilinear InterpolationIntrospectionJBeam Pretty PrinterJSON AST ParserSJSON ParserJSON Debug ParserJSON Pretty PrinterK-D Tree (2D Boxes)K-D Tree (3D)K-D Tree (3D)Lua SerializerC++/Lua BindingLua CoreLua ProfilerMath LibraryParticlesQuadtreeSettingsTCP ServerTimer SchedulerUtility Library

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 Referencecommon

UI Bridge

Module defined in `lua/common/guihooks.lua`. Bridge between Lua and the JavaScript/CEF UI layer. Provides functions to trigger UI events, send streaming data, display messages, and graph debug data.

Module defined in lua/common/guihooks.lua. Bridge between Lua and the JavaScript/CEF UI layer. Provides functions to trigger UI events, send streaming data, display messages, and graph debug data.


Exports

Functions

M.trigger(hookName, ...)

Fires a named event to the UI layer with JSON-encoded arguments.

  • Parameters:
    • hookName - string - Event name (e.g., "VehicleChange", "Message")
    • ... - any - Arguments to JSON-encode and send

M.triggerClient(targetDsmId, hookName, ...)

Fires a UI event to a specific client/display.

  • Parameters:
    • targetDsmId - number - Target display state manager ID
    • hookName - string - Event name
    • ... - any - Arguments

M.triggerRawJS(hookName, rawJs)

Fires a UI event with raw (pre-encoded) JavaScript data. Wraps the data in [...] brackets automatically.

  • Parameters:
    • hookName - string - Event name
    • rawJs - string - Pre-formatted JS data (will be wrapped as [rawJs])

M.triggerStream(streamName, streamData)

Sends streaming data to a named UI stream.

  • Parameters:
    • streamName - string - Stream identifier
    • streamData - table - Data to JSON-encode and send

M.queueStream(key, value) / M.send(key, value)

Queues stream data to be sent on the next sendStreams() call. Alias: M.send.

  • Parameters:
    • key - string - Stream name
    • value - any - Stream data

M.sendStreams()

Flushes all queued stream data to the UI. Called from the graphics step.

M.message(msg, ttl, category, icon)

Displays a UI toast/notification message.

  • Parameters:
    • msg - string - Message text
    • ttl - number|nil - Time to live in seconds (default: 5)
    • category - string|nil - Message category (default: "")
    • icon - string|nil - Icon identifier

M.graph(a, ...)

Sends data to the "Generic Graph" UI app. Each argument defines a graph line.

  • Parameters:
    • a, ... - table - Each: {key, value, scale, unit, renderNegatives, color}
  • Returns: table - Processed values array

M.graphWithCSV(filename, ...)

Like graph() but also records data to a CSV file for later export.

  • Parameters:
    • filename - string|nil - CSV filename
    • ... - table - Graph line definitions

M.graphWithCSVWrite()

Writes the accumulated CSV graph data to disk.

M.reset()

Resets stream state and triggers a VehicleReset UI event.

Variables

M.updateStreams

  • Type: boolean
  • Description: Flag indicating whether streams should be sent on the next graphics step

Internal Notes

  • Uses obj:queueHookJS() on vehicle Lua side, be:queueHookJS() on game engine side
  • Stream data is cached and sent in batch during sendStreams() to avoid per-frame overhead
  • The checkStreamsAndVehicle() function detects vehicle changes and emits VehicleChange/VehicleReset events
  • graph() auto-assigns jet-colormap colors when not specified
  • Only sends messages when playerInfo.firstPlayerSeated is true

See Also

  • cdefDebugDraw Reference - Related reference
  • cdefGpuMesh Reference - Related reference
  • cdefImgui Reference - Related reference
  • Common Libraries Overview - Guide

Graph Pathfinding

Module defined in `lua/common/graphpath.lua`. Graph-based pathfinding library implementing Dijkstra's algorithm with extensions for road networks - supports edge properties (drivability, speed limits,

Input Filter Constants

Module defined in `lua/common/inputFilters.lua`. Defines global constants for input filter types used to classify input device sources.

On this page

ExportsFunctionsM.trigger(hookName, ...)M.triggerClient(targetDsmId, hookName, ...)M.triggerRawJS(hookName, rawJs)M.triggerStream(streamName, streamData)M.queueStream(key, value) / M.send(key, value)M.sendStreams()M.message(msg, ttl, category, icon)M.graph(a, ...)M.graphWithCSV(filename, ...)M.graphWithCSVWrite()M.reset()VariablesM.updateStreamsInternal NotesSee Also