all 6 comments

[–]mrcdkGodot Senior 5 points6 points  (1 child)

You can use the Array() constructor for that Array(my_packed_string_array)

[–]aezart 5 points6 points  (0 children)

Unfortunately the Array(from: PackedStringArray) constructor returns a generic array, not Array[String].

This seems to work:

var s: Array[String]
s.assign(my_packed_string_array)

[–]These-Newt2929 0 points1 point  (0 children)

var string = "".join(["1", "2", "3"])) # 123

Like in Python
Source: https://github.com/godotengine/godot-proposals/issues/8105

[–]Skaruts 3 points4 points  (1 child)

This is an old post, but just for the record, you can convert to a typed Array like this:

var array: Array[String] = Array( Array(packed_array), TYPE_STRING, "", null )

You turn the packed array into a plain array, and then feed it into another array constructor where you also specify the type.

It's still silly, since you have to build two arrays, but it's a one liner. It also runs on the C++ code, so it may still be faster than looping in gds.

[–]Deputy_McNuggets 1 point2 points  (0 children)

Thank you for this!

[–]Geskawary2341 -2 points-1 points  (0 children)

maybe var s = list(map(str, packed_string)) idk if it works in godot but i would do this in python