Просмотр исходного кода

Merge pull request #55826 from kdiduk/gdnative-poolstringarray-join

Rémi Verschelde 3 лет назад
Родитель
Сommit
ef29a227bf

+ 11 - 0
modules/gdnative/gdnative/pool_arrays.cpp

@@ -381,6 +381,17 @@ void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self) {
 	self->invert();
 }
 
+godot_string GDAPI godot_pool_string_array_join(godot_pool_string_array *p_self, const godot_string *p_delimiter) {
+	PoolVector<String> *self = (PoolVector<String> *)p_self;
+	String &delimiter = *(String *)p_delimiter;
+
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = self->join(delimiter);
+	return str;
+}
+
 void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data) {
 	PoolVector<String> *self = (PoolVector<String> *)p_self;
 	String &s = *(String *)p_data;

+ 18 - 1
modules/gdnative/gdnative_api.json

@@ -17,7 +17,24 @@
           "major": 1,
           "minor": 2
         },
-        "next": null,
+        "next": {
+          "type": "CORE",
+          "version": {
+            "major": 1,
+            "minor": 3
+          },
+          "next": null,
+          "api": [
+            {
+              "name": "godot_pool_string_array_join",
+              "return_type": "godot_string",
+              "arguments": [
+                ["godot_pool_string_array *", "p_self"],
+                ["const godot_string *", "p_delimiter"]
+              ]
+            }
+          ]
+        },
         "api": [
           {
             "name": "godot_dictionary_duplicate",

+ 2 - 0
modules/gdnative/include/gdnative/pool_arrays.h

@@ -275,6 +275,8 @@ godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self
 
 void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self);
 
+godot_string GDAPI godot_pool_string_array_join(godot_pool_string_array *p_self, const godot_string *p_delimiter);
+
 void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data);
 
 void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx);