cast Array => int

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vivid

I do not find the conversion of an ‘Array’ int ‘, I find for a bool, string or float but not’ Array ’

Thank you.

An int is a single value whereas an Array can contain multiple values. That does not match. You can get the length of an Array with somearray.size() or you can access a single array element by index with i.e. someint = somearray[0]

If I didn’t understand you correctly then provide more details.

If you want to convert a String to an Array then you can use the split functions of the String class:
String — Godot Engine (3.1) documentation in English

You can convert to string arrays. Godot will implicitly convert the values to integer when used in contexts like calculations (but will run on an error if the value is not a number).

If you want to store/retrieve a number of different values in/from text files then it’d be best to use JSON which allows to parse an entire dictionary with arrays/values/dictionaries from a string or to encode it to a string.

wombatstampede | 2019-11-19 09:08

Yes, i look json…

Thank you wombatstampede

vivid | 2019-11-19 10:12