From 7e9574f10fad7e2cfe33fc19105d78b057d16e6e Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 24 Mar 2024 22:59:57 +0100 Subject: [PATCH] Add stringarray_to_array function Why did I not add this before...? --- docs/docs/reference/misc.md | 2 ++ src/Misc.gd | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/docs/reference/misc.md b/docs/docs/reference/misc.md index 1e64184..fd9ea33 100644 --- a/docs/docs/reference/misc.md +++ b/docs/docs/reference/misc.md @@ -48,3 +48,5 @@ func _ready() -> void: Converts an array into a string array. If an item is found that is not of type `String`, an empty array is returned. +### *Array* stringarray_to_array(*Array[String]* array) +Converts a string array into an array. diff --git a/src/Misc.gd b/src/Misc.gd index 886b480..d128cbe 100644 --- a/src/Misc.gd +++ b/src/Misc.gd @@ -71,3 +71,11 @@ func array_to_stringarray(array: Array) -> Array[String]: output.append(item) return output + +func stringarray_to_array(array: Array[String]) -> Array: + var output: Array = [] + + for item in array: + output.append(item) + + return output