API ReferenceGE Extensionsflowgraphnodestypes
Get Variable (Flowgraph Node)
- **Node Name:** `Get Variable`
Overview
- Node Name:
Get Variable - Category:
provider - File:
extensions/flowgraph/nodes/types/getVariable.lua - Icon:
cloud_download - Hidden: Yes (created via variable system, not node palette)
Reads a flowgraph variable (graph-local or project-global) and outputs its current value through a dynamically typed output pin.
Pin Schema
Output Pins
| Pin | Type | Description |
|---|---|---|
| (dynamic) | (matches variable type) | The current value of the selected variable |
The output pin is created dynamically based on the selected variable's name and type.
Internals
| Field | Purpose |
|---|---|
self.varName | Name of the selected variable |
self.global | true = reads from project-level variables; false = graph-local |
self.target | Reference to the variable store (graph.variables or graph.mgr.variables) |
self.localColor | Node tint when using local variables - ImVec4(1, 0.8, 0.6, 0.75) |
self.globalColor | Node tint when using global variables - ImVec4(1, 0.6, 0, 0.8, 0.75) |
How It Works
init()- SetsvarName = nil, defaults to local graph variables.setGlobal(global)- Switches the variable source between graph-local and project-global. Removes the current output pin and resetsvarName.setVar(name)- Looks up the variable by name, removes the old output pin, creates a new pin matching the variable's type, and reconnects compatible links.work()- Reads the variable value from the target store and writes it to the output pin.renameVariable(source, name, newName)- Called by the variable system when a variable is renamed; updates the pin name and internal references.typeUpdated(source, name, newType)- Called when a variable's type changes; recreates the output pin with the new type and reconnects compatible links.drawMiddle()- Shows the current variable value inline or???if the variable is missing.
Serialization
- Saves
varNameandglobalflag. - On deserialization, calls
setGlobal()thensetVar()to rebuild the pin.
Example Usage
-- In the flowgraph editor, this node is created automatically when
-- you drag a variable from the variable panel as a "getter".
-- It reads the variable each frame and outputs its value.
--
-- Equivalent runtime behavior:
local value = self.graph.variables:get("myVar")Additional Methods
C:_onDeserialized(nodeData)
Called after the node is deserialized (loaded from file). Restores runtime state from saved data.
Parameters:
nodeData
C:_onSerialize(res)
Called when the node is serialized (saved to file). Returns data to persist.
Parameters:
res
C:drawCustomProperties()
Custom ImGui drawing for the node's properties panel in the editor.
See Also
- Bool (Flowgraph Node) - Related reference
- Color (Flowgraph Node) - Related reference
- Generic Set/Get Variable (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide