API ReferenceGE Extensionsflowgraphnodesstring
Format String (Flowgraph Node)
- **Node Name:** `Format String`
Overview
- Node Name:
Format String - Category:
repeat_instant - File:
extensions/flowgraph/nodes/string/format.lua
Formats a string using Lua's string.format with up to 16 input values.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
value_1 .. value_N | any | Values to insert into the format pattern (dynamic, up to 16) |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | string | The formatted result string |
Data Properties
| Property | Type | Default | Description |
|---|---|---|---|
pattern | string | "%d" | Lua format string (e.g. "%s has %d points") |
Behavior
init()- Sets default pattern to"%d"and count to 1.postInit()- Creates initial input pins based on count.work()- Callsstring.format(pattern, value_1, value_2, ...)with the current count of values. Uses a large if/elseif chain for 1–16 arguments.updatePins(old, new)- Adds or removes input pins when the count changes. Cleans up links to removed pins.
Properties Editor
- Count - Integer input to set how many
value_Ninput pins exist (minimum 1, maximum 16).
Serialization
_onSerialize(res)- Savescount._onDeserialized(res)- Restorescountand recreates pins.
How It Works
- Set the
patterndata property to a Lua format string. - Adjust the count to match the number of format placeholders.
- Connect values to the
value_1,value_2, etc. input pins. - The output
valuepin receives the formatted string each frame.
-- Example: pattern = "Player %s scored %d points"
-- value_1 = "Alice" (string)
-- value_2 = 42 (number)
-- Output: "Player Alice scored 42 points"Limitations
- Maximum of 16 input values (hardcoded if/elseif chain).
- Uses Lua's standard
string.formatspecifiers (%d,%s,%f, etc.).
Key Dependencies
- Lua built-in
string.format
Additional Methods
C:drawCustomProperties()
Custom ImGui drawing for the node's properties panel in the editor.
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
See Also
- Match String (Flowgraph Node) - Related reference
- Concat (Flowgraph Node) - Related reference
- SubString (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide