Skip to content

Commit

Permalink
Merge pull request #55826 from kdiduk/gdnative-poolstringarray-join
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Jul 2, 2022
2 parents 3000d8d + bf60d65 commit ef29a22
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
11 changes: 11 additions & 0 deletions modules/gdnative/gdnative/pool_arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 18 additions & 1 deletion modules/gdnative/gdnative_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions modules/gdnative/include/gdnative/pool_arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ef29a22

Please sign in to comment.