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

Settings

Module defined in `lua/common/settings.lua`. Settings management system that loads defaults, handles deprecated/renamed settings, merges cloud and local overrides, and provides cached access to settin

Module defined in lua/common/settings.lua. Settings management system that loads defaults, handles deprecated/renamed settings, merges cloud and local overrides, and provides cached access to setting values.


Exports

Functions

M.getValue(key, defaultValue)

Retrieves a setting value by key, with fallback default.

  • Parameters:
    • key - string - Setting name
    • defaultValue - any - Value to return if the setting is nil
  • Returns: any - Setting value or default

M.getValues()

Returns the full merged settings table (defaults + cloud + local). Cached after first call.

  • Returns: table - Map of setting names to values

M.invalidateCache() / M.refresh() / M.settingsChanged()

Invalidates the cached values table, forcing re-read from files on next getValues() call.

Variables

M.path

  • Type: string - "/settings/"
  • Description: Base path for settings files

M.pathDefaults / M.pathLocal / M.pathCloud / M.pathDeprecated / M.pathSteamdeck / M.pathInternal / M.pathTorquescript

  • Type: string
  • Description: Paths to various settings files

M.defaults

  • Type: table
  • Description: Raw defaults loaded from defaults.json. Each key maps to {type_info, default_value, ...}.

M.deprecated

  • Type: table
  • Description: Deprecated settings map with replacement names and obsolete flags.

M.defaultValues

  • Type: table
  • Description: Precomputed map of setting names to their default values (extracted from defaults[key][2]).

M.internalValues

  • Type: table
  • Description: Internal settings values loaded from pathInternal. These are engine/system settings not meant for user editing.

Internal Notes

  • Settings merge order: defaults → cloud/settings.json → settings.json (local wins)
  • Deprecated settings are auto-upgraded: renamed settings map to their replacements, obsolete ones are silently dropped
  • Steam Deck overrides are applied at load time when runningOnSteamDeck is true
  • Internal (non-shipping) overrides are applied from not-shipping.internal.json when not a shipping build
  • C++ type checking: if CppSettings[k] exists, the Lua value must match its type

See Also

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

Quadtree

Module defined in `lua/common/quadtree.lua`. Quadtree spatial data structure for 2D bounding boxes with insert, remove, query, and compression. Query is remove-safe (removing items during iteration do

TCP Server

Module defined in `lua/common/tcpServer.lua`. Non-blocking TCP server with a binary-framed JSON message protocol. Supports both LuaSocket and ASIO (C++ engine) backends.

On this page

ExportsFunctionsM.getValue(key, defaultValue)M.getValues()M.invalidateCache() / M.refresh() / M.settingsChanged()VariablesM.pathM.pathDefaults / M.pathLocal / M.pathCloud / M.pathDeprecated / M.pathSteamdeck / M.pathInternal / M.pathTorquescriptM.defaultsM.deprecatedM.defaultValuesM.internalValuesInternal NotesSee Also