Add the given number to the variable value
the number to add
Converts the variable into another type.
The new type of the variable
Remove all the children.
Returns a deep copy of this variable.
Concatenate the given string at the end of the variable value
the string to append
Divide the variable value by the given number
the divisor
Unserialize a JSON string into this variable.
This just logs an error if the JSON is invalid.
A JSON string.
Converts a JavaScript object into a value compatible with GDevelop variables and store it inside this variable.
The value to convert.
Return the object containing all the children of the variable.
All the children of the variable
Return an Array containing all the children of the variable.
Get the value of the variable, considered as a boolean
The boolean value of the variable.
Get the value of the variable, considered as a number
The number stored in the variable
Get the value of the variable, considered as a string
The string stored in the variable
Get the child with the specified name or at the specified index.
If the variable is an array, prefer getChildAt
.
If the variable is a structure, prefer getChildNamed
.
If the variable has not the specified child, an empty variable with the specified name (or index) is added as child.
The child variable
Get a variable at a given index of the array.
Get the child with the specified name.
If the variable has not the specified child, an empty variable with the specified name is added as child.
The child variable
Return the length of the collection.
Returns the type of the variable.
Gets the primitive value using the getter of the current type.
Return the child in a variable.
Check if the variable has the specified children
true if variable has the children with the specified name
Return true if the variable is a number.
true if the variable is a number.
Return true if the variable type is a primitive type.
Return true if the type of the variable is a primitive type.
Return true if the variable is a structure.
true if the variable is a structure.
Check if the variable must be considered as not existing in its container (usually a gdjs.VariablesContainer).
true if the container must consider that the variable does not exist.
Multiply the variable value by the given number
the factor
Pushes a value into the array.
Pushes a copy of a variable into the array.
Removes a variable at a given index of the array.
Remove the child with the specified name.
If the variable has not the specified child, nothing is done.
The name of the child to be removed
Replaces all the children with a new map of children.
The map of new children.
Replaces all the children with a new array of children.
The array of new children.
Change the value of the variable, considered as a boolean
The new boolean to be set.
Change the value of the variable, considered as a number
The new value to be set
Change the value of the variable, considered as a string
The new string to be set
Used (usually by gdjs.VariablesContainer) to set that the variable must be considered as not existing in the container.
Sets the primitive value using the setter of the current type.
The primitive value of the variable.
Subtract the given number to the variable value
the number to subtract
Converts this variable into an equivalent JavaScript object.
A JavaScript object equivalent to the variable.
Toggle the value of the variable, considered as a boolean.
Get the value of the variable, as a number if it's one, or as a string (if it's a string or something else)
In most cases, prefer calling getAsNumber
or getAsString
directly.
This is a fallback in case a variable type can't be known statically for sure,
like getValue
.
Generated using TypeDoc
A Variable is an object storing a value (number or a string) or children variables.