RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Collection Marker (Flowgraph Node)Custom Lua Command (Flowgraph Node)Get Object Field (Flowgraph Node)Get Player Vehicle ID (Flowgraph Node)Get Point on Decalroad (Flowgraph Node)Show/Hide Object (Flowgraph Node)ID by Name (Flowgraph Node)Keep Prefab (Flowgraph Node)Particle Emitter (Flowgraph Node)Point on Decalroad (Flowgraph Node)Raceline Parking (Flowgraph Node)Raycast (Flowgraph Node)Parking Markers / Rect Marker (Flowgraph Node)Reload Collision (Flowgraph Node)Reload Nav Graph (Flowgraph Node)Remove Prefab (Flowgraph Node)Reset Prefab (Flowgraph Node)Set Object Field (Flowgraph Node)Sevensegment Display (Flowgraph Node)Single Marker (Flowgraph Node)Spawn Light / SpotLight (Flowgraph Node)Spawn Prefab (Flowgraph Node)Spawn TSStatic (Flowgraph Node)Store Statics (Flowgraph Node)Track Prefab (Flowgraph Node)

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 Extensionsflowgraphnodesscene

Custom Lua Command (Flowgraph Node)

- **Node Name:** `Custom Lua Command`

Overview

  • Node Name: Custom Lua Command
  • Category: once_instant
  • File: extensions/flowgraph/nodes/scene/customLuaCommand.lua

Executes an arbitrary Lua string within the flowgraph and optionally captures the return value.

Pin Schema

Input Pins

PinTypeDescription
funcstringThe Lua code string to execute

Output Pins

PinTypeDescription
flowflowTrue if execution succeeded (pcall status)
returnanyThe return value of the executed code, if any

Behavior

  • init() - Sets clearOutPinsOnStart = false to preserve the return value across frames.
  • _executionStarted() - Clears the return output pin.
  • workOnce() - If func has a value:
    1. Compiles the string with loadstring(func).
    2. Executes it safely with pcall().
    3. Sets flow output to the pcall success status.
    4. Sets return output to the return value.
  • _onDeserialized() - Handles legacy data format where func was stored in data.func, migrating it to a hardcoded pin.

Key Dependencies

  • loadstring() - Compiles a Lua string into a callable function
  • pcall() - Protected call for safe execution

How It Works

This is the escape hatch node - it lets flowgraph authors run arbitrary GE Lua code. The code string is compiled and executed in a protected call, so errors won't crash the flowgraph (they'll just set flow to false). The return value is captured and can be wired to other nodes.

Example Usage

-- Execute arbitrary Lua from flowgraph
-- func = "return be:getObjectCount()"
-- The return pin will contain the object count

-- Side effects work too
-- func = "log('I', 'fg', 'Hello from flowgraph!')"

-- Access any GE API
-- func = "return core_vehicles.getCurrentVehicleDetails()"

See Also

  • Collection Marker (Flowgraph Node) - Related reference
  • Get Object Field (Flowgraph Node) - Related reference
  • Get Player Vehicle ID (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Collection Marker (Flowgraph Node)

- **Node Name:** `Collection Marker`

Get Object Field (Flowgraph Node)

- **Node Name:** `Get Object Field`

On this page

OverviewPin SchemaInput PinsOutput PinsBehaviorKey DependenciesHow It WorksExample UsageSee Also