API ReferenceGE Extensionsflowgraphnodestypes
Generic Set/Get Variable (Flowgraph Node)
- **Node Name:** `Generic Set/Get Variable`
Overview
- Node Name:
Generic Set/Get Variable - Category:
repeat_instant - File:
extensions/flowgraph/nodes/types/genericValue.lua
A dual-purpose node that either gets or sets a named flowgraph variable. Can operate on project-level (global) or graph-level variables.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Inflow for this node |
varName | string | Name of the variable |
suffix | number | Optional suffix appended to the variable name |
Conditional Pins
| Mode | Pin | Direction | Type | Description |
|---|---|---|---|---|
| Getter | val | out | any | Retrieved variable value |
| Setter | val | in | any | Value to assign to the variable |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Passes through input flow |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
getter | bool | true | If true, reads the variable; if false, writes it |
global | bool | true | If true, uses project variables; if false, uses graph variables |
Behavior
init()- Defaults to getter mode with global scope. Sets up get pins.work()- Constructs the variable name fromvarName+ optionalsuffix. In getter mode, callsself.target:get(varName). In setter mode, callsself.target:change(varName, value).setupGetPins()- Removes any existingvalpins, creates anoutpin namedval.setupSetPins()- Removes any existingvalpins, creates aninpin namedval.
Serialization
_onSerialize(res)- Savesgetterandglobalflags._onDeserialized(nodeData)- Restores flags and sets up appropriate pins.
How It Works
- Set
varNameto the variable you want to access. - Toggle
getterin properties to switch between read/write mode. - Toggle
globalto choose between project-level and graph-level scope. - Optionally use
suffixfor dynamic variable names (e.g."score"+1→"score1").
-- Getter mode:
-- varName = "playerScore", suffix = nil
-- Reads from project variables: self.mgr.variables:get("playerScore")
-- Output: val = current value
-- Setter mode:
-- varName = "playerScore", val = 100
-- Writes to project variables: self.mgr.variables:change("playerScore", 100)Key Dependencies
self.mgr.variables- Project-level variable storageself.mgr.graph.variables- Graph-level variable storage
Additional Methods
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
- Get Variable (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide