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
Foreach (Flowgraph Node)Get Foreach (Flowgraph Node)Integrated (Flowgraph Node)I/O (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 Extensionsflowgraphnodesmacro

Get Foreach (Flowgraph Node)

- **Node Name:** `Get Foreach`

Overview

  • Node Name: Get Foreach
  • Category: provider
  • File: extensions/flowgraph/nodes/macro/getForeach.lua

Retrieves the key and value for the current iteration when used inside a flowgraph spawned by a Foreach node.

Pin Schema

Input Pins

None.

Output Pins

PinTypeDescription
keystring/idThe key of this element in the iterated table
valueanyThe value of this element in the iterated table

Behavior

  • _executionStarted() - Reads self.mgr.modules.foreach.key and .value and writes them to the output pins. These values are set by the parent Foreach node before starting this flowgraph.

How It Works

This is the companion node to Foreach. When a Foreach node spawns a flowgraph for each table element, it injects the current key and value into the flowgraph manager's modules.foreach table. This node reads those values at execution start and exposes them as output pins.

The values are set once at execution start and don't change during the flowgraph's lifetime.

Example Usage

-- Inside a flowgraph loaded by Foreach:
-- [Get Foreach] → key (e.g., 1) and value (e.g., "vehicleData")
-- Use these outputs to drive per-element logic

-- Parent flowgraph:
-- table = {a = "alpha", b = "beta"}
-- Foreach spawns 2 instances:
--   Instance 1: key="a", value="alpha"
--   Instance 2: key="b", value="beta"

Additional Methods

C:init(mgr, ...)

Initializes the node, setting up pins and default properties.

Parameters:

  • mgr
  • ...

C:postInit()

Called after initialization is complete for additional setup.


See Also

  • Foreach (Flowgraph Node) - Related reference
  • Integrated (Flowgraph Node) - Related reference
  • I/O (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Foreach (Flowgraph Node)

- **Node Name:** `Foreach`

Integrated (Flowgraph Node)

- **Node Name:** `Integrated`

On this page

OverviewPin SchemaInput PinsOutput PinsBehaviorHow It WorksExample UsageAdditional MethodsC:init(mgr, ...)C:postInit()See Also