RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Ambient SoundUI Apps ManagerUI AudioBindings LegendCamera Distance AppDeveloper ConsoleCredits MusicExternal WebSocket ServerFade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsNavigation Map DataVehicle Paint EditorVehicle Vicinity AppUI Visibility
Camera ManagementAction Map ManagementEdit Mode State MachineLivery EditorUndo/Redo WrapperLayer ActionsLayer Edit LifecycleLayer DataDecal Texture LoaderLayer SelectionToolsLivery FilesMath Utilities

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 ReferenceGE ExtensionsuiliveryEditor

Livery Files

Manages livery save files - listing, creating, renaming, and deleting `.dynDecals.json` files.

Manages livery save files - listing, creating, renaming, and deleting .dynDecals.json files.


Overview

ui_liveryEditor_userData provides CRUD operations for livery save files stored in settings/dynamicDecals/. It handles filename validation, file system operations, and notifies the UI when the file list changes.

Extension path: lua/ge/extensions/ui/liveryEditor/userData.lua


Exports (M)

FunctionSignatureDescription
requestUpdatedData()Triggers LiverySaveFilesUpdated with the current save file list.
saveFileExists(filename) → boolChecks if a save file exists by name.
getSaveFiles() → file[]Returns all save files with metadata (name, location, dates, size).
createSaveFile(filename) → path/falseValidates filename and saves the layer stack. Returns the file path.
renameFile(filename, newFilename) → boolRenames an existing save file.
deleteSaveFile(filename) → boolDeletes a save file.
getFilename(file) → stringExtracts the display name from a full file path.

Internals

File Constants

local saveDir = "settings/dynamicDecals/"
local FILENAME_PATTERN = "^[a-zA-Z0-9_-]+$"
local dynDecalsExtension = ".dynDecals.json"

Save File Format

Each file entry returned by getSaveFiles():

{
  name = "mySkin",                              -- display name (no extension)
  location = "settings/dynamicDecals/mySkin.dynDecals.json",
  created = 1703275200,                         -- unix timestamp
  modified = 1703275200,                        -- unix timestamp
  fileSize = 4096                               -- bytes
}

Filename Validation

Only alphanumeric characters, hyphens, and underscores are allowed:

if not string.match(filename, "^[a-zA-Z0-9_-]+$") then
  log("W", "", "Cannot create invalid filename: " .. filename)
  return false
end

File Operations

  • Create: api.saveLayerStackToFile(path) serialises the current layer stack
  • Rename: FS:renameFile(oldPath, newPath) - returns 0 on success
  • Delete: FS:removeFile(path)

All mutations trigger LiverySaveFilesUpdated to refresh the UI file browser.


How It Works

  1. The save directory is scanned for *.dynDecals.json files via FS:findFiles
  2. Each file's stats (creation time, mod time, size) are read via FS:stat
  3. Creating a save validates the filename pattern, then serialises the layer stack
  4. Rename and delete operations validate file existence before proceeding
  5. UI is notified after every mutation

Example Usage

local userData = extensions.ui_liveryEditor_userData

-- List all saves
local files = userData.getSaveFiles()
for _, f in ipairs(files) do
  print(f.name, f.modified)
end

-- Create a new save
local path = userData.createSaveFile("myRacingLivery")

-- Rename
userData.renameFile("myRacingLivery", "myRacingLivery_v2")

-- Delete
userData.deleteSaveFile("myRacingLivery_v2")

Additional Exports

The following exports are available but not yet documented in detail:

  • M.createSaveFile
  • M.deleteSaveFile
  • M.getFilename
  • M.getSaveFiles
  • M.renameFile
  • M.requestUpdatedData
  • M.saveFileExists

See Also

  • Livery Editor - Camera - Related reference
  • Livery Editor - Controls - Related reference
  • Livery Editor - Edit Mode - Related reference
  • UI System Guide - Guide

Tools

Central tool manager - switches active tools, manages action maps, and dispatches operations to cursor or layer targets.

Math Utilities

Math and conversion utilities shared across the livery editor modules.

On this page

OverviewExports (M)InternalsFile ConstantsSave File FormatFilename ValidationFile OperationsHow It WorksExample UsageAdditional ExportsSee Also