diff options
Diffstat (limited to 'modules/regex')
-rw-r--r-- | modules/regex/doc_classes/RegEx.xml | 2 | ||||
-rw-r--r-- | modules/regex/doc_classes/RegExMatch.xml | 2 | ||||
-rw-r--r-- | modules/regex/regex.cpp | 8 | ||||
-rw-r--r-- | modules/regex/regex.h | 4 | ||||
-rw-r--r-- | modules/regex/tests/test_regex.h | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml index 9adb6acd9c..56404f796c 100644 --- a/modules/regex/doc_classes/RegEx.xml +++ b/modules/regex/doc_classes/RegEx.xml @@ -76,7 +76,7 @@ </description> </method> <method name="get_names" qualifiers="const"> - <return type="Array" /> + <return type="PackedStringArray" /> <description> Returns an array of names of named capturing groups in the compiled pattern. They are ordered by appearance. </description> diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml index 5bcf070e82..31e2207d84 100644 --- a/modules/regex/doc_classes/RegExMatch.xml +++ b/modules/regex/doc_classes/RegExMatch.xml @@ -44,7 +44,7 @@ <member name="names" type="Dictionary" setter="" getter="get_names" default="{}"> A dictionary of named groups and its corresponding group number. Only groups that were matched are included. If multiple groups have the same name, that name would refer to the first matching one. </member> - <member name="strings" type="Array" setter="" getter="get_strings" default="[]"> + <member name="strings" type="PackedStringArray" setter="" getter="get_strings" default="PackedStringArray()"> An [Array] of the match and its capturing groups. </member> <member name="subject" type="String" setter="" getter="get_subject" default=""""> diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 569066867a..c808211d68 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -82,8 +82,8 @@ Dictionary RegExMatch::get_names() const { return result; } -Array RegExMatch::get_strings() const { - Array result; +PackedStringArray RegExMatch::get_strings() const { + PackedStringArray result; int size = data.size(); @@ -351,8 +351,8 @@ int RegEx::get_group_count() const { return count; } -Array RegEx::get_names() const { - Array result; +PackedStringArray RegEx::get_names() const { + PackedStringArray result; ERR_FAIL_COND_V(!is_valid(), result); diff --git a/modules/regex/regex.h b/modules/regex/regex.h index 9296de929f..ac518f16df 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -63,7 +63,7 @@ public: int get_group_count() const; Dictionary get_names() const; - Array get_strings() const; + PackedStringArray get_strings() const; String get_string(const Variant &p_name) const; int get_start(const Variant &p_name) const; int get_end(const Variant &p_name) const; @@ -94,7 +94,7 @@ public: bool is_valid() const; String get_pattern() const; int get_group_count() const; - Array get_names() const; + PackedStringArray get_names() const; RegEx(); RegEx(const String &p_pattern); diff --git a/modules/regex/tests/test_regex.h b/modules/regex/tests/test_regex.h index 91af393db1..c81094d3ae 100644 --- a/modules/regex/tests/test_regex.h +++ b/modules/regex/tests/test_regex.h @@ -46,7 +46,7 @@ TEST_CASE("[RegEx] Initialization") { CHECK(re1.get_pattern() == pattern); CHECK(re1.get_group_count() == 1); - Array names = re1.get_names(); + PackedStringArray names = re1.get_names(); CHECK(names.size() == 1); CHECK(names[0] == "vowel"); |