settings Reference
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 namedefaultValue- 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
runningOnSteamDeckis true - Internal (non-shipping) overrides are applied from
not-shipping.internal.jsonwhen not a shipping build - C++ type checking: if
CppSettings[k]exists, the Lua value must match its type
quadtree Reference
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
tcpServer Reference
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.