blockly > CodeGenerator > getVariableName
CodeGenerator.getVariableName() method
Gets a unique, legal name for a user-defined variable. Before calling this method, the nameDB_
property of the class must have been initialized already. This is typically done in the init
function of the code generator class.
Signature:
getVariableName(nameOrId: string): string;
Parameters
Parameter | Type | Description |
---|---|---|
nameOrId | string | The ID of the variable to get a name for, or the proposed name for a variable not associated with an id. |
Returns:
string
A unique, legal name for the variable.