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
calltracer ReferencedateUtils ReferencedebugDraw Referencefilterchain Referenceutils/ - Utility Modulesheatmap ReferencehttpJsonServer ReferenceinteractiveShell ReferencelanguageMap Referenceperf Referencepixellib ReferencesimpleHttpServer ReferencetorqueScriptParser ReferencewsUtils 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 Referencecommonutils

perf Reference

Module defined in `lua/common/utils/perf.lua`. Performance profiler that tracks function execution times using debug hooks, with windowed statistics and CSV export.

Module defined in lua/common/utils/perf.lua. Performance profiler that tracks function execution times using debug hooks, with windowed statistics and CSV export.


Exports

Functions

M.enable(_windowSize, _guiHook, _srcData)

Enable performance profiling.

  • Parameters:
    • _windowSize - number - Number of frames to average over
    • _guiHook - string|nil - GUI hook name for display
    • _srcData - table|nil - External data source

M.disable()

Disable performance profiling and remove debug hooks.

M.update()

Process accumulated profiling data for the current frame. Call each frame.

M.getData()

Get the current profiling statistics.

  • Returns: table - Statistics data table

M.saveDataToCSV(filename)

Export profiling data to a CSV file.

  • Parameters:
    • filename - string - Output CSV file path

Variables

M.data

  • Type: table
  • Description: Current frame statistics including frameCount, size (window size), memory (Lua memory usage), and per-function timing data

Internal Notes

  • Uses debug.sethook with "cr" (call/return) events for timing
  • start(name) / stop(name) internal functions bracket timed sections
  • _update computes windowed averages each frame
  • Memory tracked via gcinfo()

languageMap Reference

Module defined in `lua/common/utils/languageMap.lua`. Maps ISO language and country codes to human-readable names. Includes Weblate translation platform codes.

pixellib Reference

Module defined in `lua/common/utils/pixellib.lua`. Small pixel drawing library for rendering primitives and text to RGBA buffers, with file save support.

On this page

ExportsFunctionsM.enable(_windowSize, _guiHook, _srcData)M.disable()M.update()M.getData()M.saveDataToCSV(filename)VariablesM.dataInternal Notes