blockly > VariableMap > getVariable
VariableMap.getVariable() 方法
按指定名称和类型查找变量,并返回。如果未找到,则返回 null。
Signature:
getVariable(name: string, opt_type?: string | null): VariableModel | null;
参数
参数 | 类型 | 说明 |
---|---|---|
name | string | 要检查的名称。 |
opt_type | 字符串 | null | (可选)变量的类型。如果未提供,则默认为空字符串,这是一个特定类型。 |
返回:
VariableModel | null
具有指定名称的变量,如果未找到,则为 null。