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

Timer Scheduler

Module defined in `lua/common/timeEvents.lua`. A lightweight timer/scheduler that lets you schedule function callbacks to fire after a specified delay. Similar to the global `schedule()` function.

Module defined in lua/common/timeEvents.lua. A lightweight timer/scheduler that lets you schedule function callbacks to fire after a specified delay. Similar to the global schedule() function.


Exports

Functions

M.create()

Creates a new time events scheduler instance.

  • Returns: table - A scheduler object with :addEvent(), :clear(), and :process() methods

Instance Methods

scheduler:addEvent(time, fn)

Schedules a function to be called after the specified time.

  • Parameters:
    • time - number - Delay in seconds before firing
    • fn - function - Callback to invoke when time expires

scheduler:clear()

Removes all pending scheduled events.

scheduler:process(dt)

Advances all timers by dt and fires any that have expired. Must be called each frame.

  • Parameters:
    • dt - number - Delta time in seconds since last call

Internal Notes

  • Events are stored as {fn, time} entries in an array
  • Processes in reverse order to safely remove expired events via table.remove
  • Fired events are removed; there is no repeat/interval mechanism

See Also

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

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.

Utility Library

Module defined in `lua/common/utils.lua`. Massive utility library providing color functions, JSON encoding/decoding, table manipulation, string utilities, file I/O, serialization, debugging tools, and

On this page

ExportsFunctionsM.create()Instance Methodsscheduler:addEvent(time, fn)scheduler:clear()scheduler:process(dt)Internal NotesSee Also