With this function you can turn any real number into a string. If the real number is an integer, it will be saved with no decimal places, otherwise, it will be saved with two decimal places. If you require more decimal places, then use the function string_format(). Also note that using this function on a variable storing an array, a data structure, or a struct will convert the contents of these variables into a string which can then be output to the console or saved to a file for debugging.
string(val);
| Argument | Description |
|---|---|
| string | The real number to be turned into a string. |
String
draw_text(100, 100, "Score: " + string(score) + " / Health: " + string(health));
The above code uses the string function to draw both real numbers and strings together (draw will only accept either a string or a real, but not both).