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

luaCore Reference

Module defined in `lua/common/luaCore.lua`. Adds core language features and polyfills used throughout the codebase - optional require, module reload, table utilities, and FFI initialization.

Module defined in lua/common/luaCore.lua. Adds core language features and polyfills used throughout the codebase - optional require, module reload, table utilities, and FFI initialization.


Exports

All exports are global functions/variables.

Functions

require_optional(module)

Safely attempts to require a module, returning nil on failure instead of throwing an error.

  • Parameters:
    • module - string - Module path to require
  • Returns: table|nil - The loaded module or nil if not found

unrequire(m)

Unloads a previously required module by clearing it from package.loaded and _G.

  • Parameters:
    • m - string - Module name to unload

rerequire(module)

Force-reloads a module from disk by clearing the cache first, then requiring it again.

  • Parameters:
    • module - string - Module path to reload
  • Returns: table|nil - The freshly loaded module

nop()

A no-operation function. Used as a placeholder/default callback throughout the codebase.

Variables

ffi

  • Type: table|nil
  • Description: Global reference to the LuaJIT FFI library, set via require_optional('ffi'). Nil if FFI is unavailable.

Internal Notes

  • Also polyfills table.clear and table.new if the LuaJIT extensions aren't available
  • Must be loaded very early in initialization as many other modules depend on ffi, nop, require_optional

luaBinding Reference

Module defined in `lua/common/luaBinding.lua`. Core C++/Lua binding infrastructure implementing property getters/setters, inheritance chains, and SimObject field access for engine-bound classes.

luaProfiler Reference

Module defined in `lua/common/luaProfiler.lua`. A Lua code profiler that measures execution time and garbage generation for code sections, with optional peak detection and smoothed statistics.

On this page

ExportsFunctionsrequire_optional(module)unrequire(m)rerequire(module)nop()VariablesffiInternal Notes