RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Sites Custom FieldsSites LocationSites Parking SpotSites ContainerSites ManagerSites Zone

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 Extensionsgameplaysites

Sites Custom Fields

Class for managing typed custom fields and tags on sites objects (locations, zones, parking spots). Supports `string`, `number`, and `vec3` field types plus a tag set.

Class for managing typed custom fields and tags on sites objects (locations, zones, parking spots). Supports string, number, and vec3 field types plus a tag set.


Constructor

local CustomFields = require('gameplay/sites/customFields')
local fields = CustomFields()

Methods

MethodSignatureReturnsDescription
add(name, type, value)boolAdd a new field (fails if exists)
remove(name)boolRemove a field by name
set(name, value)boolUpdate existing field value
get(name)value, type, foundGet field value, type, and existence flag
has(name)boolCheck if field exists
addTag(tag)boolAdd a tag (fails if duplicate)
removeTag(tag)boolRemove tag by string or index
onSerialize()tableSerialize fields and tags
onDeserialized(data)nilRestore from serialized data

Internals

  • names: Ordered array of field names
  • types: Map of name → type ("string", "number", "vec3")
  • values: Map of name → value
  • tags: Set of tag → 1
  • sortedTags: Sorted array of tag strings (rebuilt on change)

How It Works

Fields are typed key-value pairs with insertion-order tracking. Tags are an unordered set that auto-sorts when modified. Serialization converts vec3 values to tables.

local fields = CustomFields()

-- Add typed fields
fields:add("speed", "number", 120)
fields:add("label", "string", "Start Line")
fields:add("offset", "vec3", vec3(1, 2, 3))

-- Query
local val, typ, found = fields:get("speed")  -- 120, "number", true

-- Tags
fields:addTag("parking")
fields:addTag("accessible")
-- fields.sortedTags = {"accessible", "parking"}

-- Serialize for JSON
local data = fields:onSerialize()
-- { names={"speed","label","offset"}, types={...}, values={...}, tags={"accessible","parking"} }

Notes

  • set("tags", ...) triggers updateTags() - but tags are normally managed via addTag/removeTag
  • removeTag accepts either a string or numeric index into sortedTags
  • Used by location, zone, and parkingSpot classes
FunctionSignatureReturnsDescription
M.init()nilinit

See Also

  • Sites Location - Related reference
  • Sites Parking Spot - Related reference
  • Sites Container - Related reference
  • Gameplay Systems Guide - Guide

Gameplay Route

Core route class for navigation pathfinding. Creates a path between positions using the map graph, tracks vehicle position along it, and auto-recalculates when off-route.

Sites Location

Class representing a named point location within the sites system. Has a position, radius, color, and custom fields. Used for marking points of interest within zones.

On this page

ConstructorMethodsInternalsHow It WorksNotesSee Also