API ReferenceGE Extensionsflowgraphnodesutil
Get First Element of Table (Flowgraph Node)
- **Node Name:** `Get First Element of Table`
Overview
- Node Name:
Get First Element of Table - Category:
repeat_instant - File:
extensions/flowgraph/nodes/util/firstElement.lua
Extracts the first element (index 1) from an input table.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
table | table | The table to get the first element of |
Output Pins
| Pin | Type | Description |
|---|---|---|
firstElement | any | The first element of the table |
Internals
Key Methods
| Method | Description |
|---|---|
init(mgr) | Empty initializer |
_executionStarted() | Resets oldPos to nil |
getFirstElement(table) | Returns self.pinIn.table.value[1] |
work() | Outputs first element every frame if table is present |
How It Works
- Checks if the
tableinput has a value. - Returns
table[1]- the first element using Lua's 1-based indexing. - Runs every frame (
repeat_instantcategory).
Usage Example
-- Get the first waypoint from a list:
-- [Get Waypoints] → table → [Get First Element] → firstElement → [Use Position]
-- Get the first vehicle ID from a filtered list:
-- [Get Vehicle IDs] → table → [Get First Element] → firstElement → [Focus Camera]Key Dependencies
None - pure table indexing utility.
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide