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

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

devUtils Reference

Module defined in `lua/common/devUtils.lua`. Development utilities for sandboxed Lua execution, module local variable introspection, global state snapshots, and table recursion detection.

Module defined in lua/common/devUtils.lua. Development utilities for sandboxed Lua execution, module local variable introspection, global state snapshots, and table recursion detection.


Exports

All exports are global functions (no module table).

Functions

executeLuaSandboxed(cmd, source)

Executes a Lua string in a sandboxed environment with stdout capture.

  • Parameters:
    • cmd - string - Lua code to execute
    • source - string|nil - Source name for error reporting (default: "executeLuaSandboxed")
  • Returns: any, table|nil - Result of execution (or error string), and captured stdout lines

getModuleLocals(moduleTbl)

Returns all upvalue locals used by functions in a module table. Useful for introspection and serialization.

  • Parameters:
    • moduleTbl - table - The module table to inspect
  • Returns: table - Map of local variable names to their values

createGlobalSnapshot(filename)

Serializes the entire global Lua state to a JSON file for debugging. Captures all global tables, their locals, extension state, and variables.

  • Parameters:
    • filename - string - Output JSON filename

tableFindRecursion(tbl)

Detects tables that appear at multiple paths within a table hierarchy (shared references).

  • Parameters:
    • tbl - table - Root table to inspect
  • Returns: number, table - Count of duplicate table references, and a map of table pointers to their paths

Internal Notes

  • executeLuaSandboxed is NOT truly safe - it can access hidden objects through the environment
  • The sandbox captures print() output and redirects it to a table
  • createGlobalSnapshot skips functions, extension modules, and the global table itself
  • Internal helpers: _findUpValuesFromFunction, _recFindUpvalues, _cleanupCloneTbl, _createGraphviz

dequeue Reference

Module defined in `lua/common/dequeue.lua`. Double-ended queue (deque) implementation supporting push/pop from both ends, rotation, removal, and iteration. Based on Pierre Chapuis's library.

Event Reference

Module defined in `lua/common/event.lua`. Implements a simple event/delegate class for publish-subscribe patterns. Subscribers register functions that get called when the event fires.

On this page

ExportsFunctionsexecuteLuaSandboxed(cmd, source)getModuleLocals(moduleTbl)createGlobalSnapshot(filename)tableFindRecursion(tbl)Internal Notes