MCPcopy Index your code
hub / github.com/4ian/GDevelop / getAsString

Method getAsString

GDJS/Runtime/variable.ts:590–600  ·  view source on GitHub ↗

* Get the value of the variable, considered as a string * @return The string stored in the variable

()

Source from the content-addressed store, hash-verified

588 * @return The string stored in the variable
589 */
590 getAsString(): string {
591 if (this._type !== 'string') {
592 if (this._type === 'number') return this._value.toString();
593 else if (this._type === 'boolean') return this._bool ? 'true' : 'false';
594 else if (this._type === 'structure') return '[Structure]';
595 else if (this._type === 'array') return '[Array]';
596 else return '';
597 }
598
599 return this._str;
600 }
601
602 /**
603 * Change the value of the variable, considered as a string

Callers 15

toJSObjectMethod · 0.95
castToMethod · 0.95
getAsNumberOrStringMethod · 0.95
getValueMethod · 0.95
concatenateStringMethod · 0.95
concatenateMethod · 0.95
checkFixturesInFileFunction · 0.95
loadFromSceneVariableFunction · 0.45
SaveState.spec.jsFile · 0.45
getVariableStringMethod · 0.45

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected