Function: getVariable()
function getVariable(
workspace,
id,
opt_name?,
opt_type?
):
| IVariableModel<IVariableState>
| null;
Defined in: packages/blockly/core/variables.ts:691
Look up a variable on the given workspace. Always looks in the main workspace before looking in the flyout workspace. Always prefers lookup by ID to lookup by name + type.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspace | Workspace | The workspace to search for the variable. It may be a flyout workspace or main workspace. |
id | string | null | The ID to use to look up the variable, or null. |
opt_name? | string | The string to use to look up the variable. Only used if lookup by ID fails. |
opt_type? | string | The type to use to look up the variable. Only used if lookup by ID fails. |
Returns
| IVariableModel<IVariableState>
| null
The variable corresponding to the given ID or name + type combination, or null if not found.