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
| Pin | Type | Description |
|---|---|---|
func | string | The Lua code string to execute |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | True if execution succeeded (pcall status) |
return | any | The return value of the executed code, if any |
Behavior
init()- SetsclearOutPinsOnStart = falseto preserve the return value across frames._executionStarted()- Clears thereturnoutput pin.workOnce()- Iffunchas a value:- Compiles the string with
loadstring(func). - Executes it safely with
pcall(). - Sets
flowoutput to the pcall success status. - Sets
returnoutput to the return value.
- Compiles the string with
_onDeserialized()- Handles legacy data format wherefuncwas stored indata.func, migrating it to a hardcoded pin.
Key Dependencies
loadstring()- Compiles a Lua string into a callable functionpcall()- 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