RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference

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

timeEvents Reference

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

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.

utils Reference

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 Notes