RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
Activity ManagerAudio Bank ManagerAudio Ribbon SystemBus Route ManagerCamera SystemCore Chat (IRC)Core CheckpointsCore Command HandlerCoupler Camera ModifierDevices (RGB Peripherals)Dynamic PropsEnvironmentFlowgraph ManagerForestFun StuffGame ContextGame StateGround Marker ArrowsGround MarkersHardware InfoHighscoresHotlappingInventoryJob SystemLap TimesLevelsLoad Map CommandMetricsMod ManagerMultiseatMultiseat CameraMulti SpawnOnlinePaths (Camera Paths)Quick Access (Radial Menu)Recovery PromptRemote ControllerReplayRepositoryRope Visual TestScheme Command ServerCore SnapshotCore SoundsCore TerrainTraffic SignalsTrailer RespawnVehicle Active PoolingVehicle Bridge (GE ↔ VLua Communication)Vehicle MirrorsVehicle PaintsCore VehiclesVehicle TriggersVersion UpdateWeather SystemWindows Console

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 Extensionscore

Job System

Coroutine-based job system for running background tasks without blocking the game. Jobs yield control back to the engine periodically, allowing frame rendering to continue during long operations.

Coroutine-based job system for running background tasks without blocking the game. Jobs yield control back to the engine periodically, allowing frame rendering to continue during long operations.


Public Functions

FunctionSignatureDescription
M.create(fct, maxdt, ...) → jobCreates and starts a new coroutine job
M.wrap(fct, maxdt) → wrappedFnReturns a function that creates a job when called (prevents duplicate runs)
M.getRunningJobCount() → numberReturns the number of currently active jobs
M.onUpdate(dtReal, dtSim, dtRaw)Resumes all active coroutines each frame

Job Object

The job object is passed as the first argument to the work function:

MethodDescription
job.yield()Yields if maxdt seconds have elapsed since last yield
job.sleep(secs)Pauses execution for the given number of seconds
job.setExitCallback(fct)Registers a callback invoked when the job completes
job.runningBoolean - true while the job is active

Usage Example

-- Simple background task
local function myTask(job, arg1, arg2)
  for i = 1, 100 do
    -- Do work...
    job.yield()  -- Give the game time to render
  end
  job.sleep(2)   -- Wait 2 seconds
  -- More work...
end

-- Start with 1 second max between yields (good for background tasks)
extensions.core_jobsystem.create(myTask, 1, "hello", 42)

-- Wrapped version (prevents duplicate runs)
local doCheck = extensions.core_jobsystem.wrap(function(job)
  -- Long operation...
  job.yield()
end, 0.5)

doCheck()  -- First call starts the job
doCheck()  -- Ignored if already running

Parameters

ParameterTypeDefaultDescription
fctfunctionrequiredThe work function to run as a coroutine
maxdtnumber0.01Max seconds between automatic yields (controls responsiveness)
...any-Additional arguments passed to fct

Hooks

HookTrigger
onUpdateEvery frame - resumes all active coroutines
onJobDoneFired via extensions.hook when a job completes

Notes

  • If disableBackgroundTasks is true, jobs run synchronously (foreground mode).
  • wrap prevents the same function from running concurrently - a second call is silently ignored.
  • On error, the job logs the error with traceback and is removed.
  • The onUpdate hook passes {dtReal, dtSim, dtRaw} as the second argument when no custom args exist.
  • Used extensively by core_modmanager.initDB and core_repository.checkUpdate.

See Also

  • modmanager - Uses jobsystem for background mod initialization
  • globals - Extension lifecycle hooks

Inventory

Simple key-value inventory system for tracking items (vehicles, parts, currency) during campaigns/scenarios. Supports adding, removing, and querying items by type, with campaign save/resume hooks.

Lap Times

Lap and segment timing system for races. Tracks current time, lap/segment splits, best times, and diffs. Streams formatted timing data to the UI via `guihooks.queueStream`.

On this page

Public FunctionsJob ObjectUsage ExampleParametersHooksNotesSee Also