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

Lua Core

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

See Also

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

C++/Lua Binding

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.

Lua Profiler

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 NotesSee Also