API ReferenceGE Extensionseditorflowgraph
Flowgraph Mission Variable Helper
Shared utility module for applying mission variables from the Mission Editor to flowgraph managers before execution.
Shared utility module for applying mission variables from the Mission Editor to flowgraph managers before execution.
Overview
missionVariableHelper provides two key functions: checking whether a flowgraph manager's saved path matches a selected mission, and applying that mission's missionTypeData variables to the manager's variable system. It also injects the player vehicle ID into common variable names (playerID, vehID, etc.).
Public Functions
| Function | Returns | Description |
|---|---|---|
M.checkMissionMatch(mgr, selectedMission) | matchType, mgrPath, missionPath | Compare manager path against mission flowgraph path |
M.applyMissionVariablesToManager(mgr, logTag) | bool | Apply all mission variables + vehicle ID to manager |
Match Types
| Type | Meaning |
|---|---|
"exact" | Manager path exactly matches mission flowgraph path |
"missionTypeMain" | Manager is the mission type's main flowgraph |
"sameMissionType" | Manager is in the same mission type folder |
"differentMissionType" | Manager is from a different mission type |
"noMission" | No mission selected or no manager |
Variable Injection
The helper applies variables in two passes:
- Mission variables: Iterates
selectedMission.missionTypeDataand callsmgr.variables:changeBase(name, value)for each existing variable - Vehicle ID injection: Checks for
playerID,playerId,vehID,vehIdvariables and injects the current player vehicle ID
Usage Example
local missionVarHelper = require('/lua/ge/extensions/editor/flowgraph/missionVariableHelper')
-- Check match type
local matchType = missionVarHelper.checkMissionMatch(mgr, selectedMission)
-- Apply variables before starting execution
local applied = missionVarHelper.applyMissionVariablesToManager(mgr, "myModule")
if applied then
log("I", "", "Mission variables applied successfully")
end
mgr:setRunning(true)See Also
- Flowgraph Base Window - Related reference
- Flowgraph Events - Related reference
- Flowgraph Examples - Related reference
- World Editor Guide - Guide