Skip to content

Commit

Permalink
Also added the new helper method to the gdnative api.
Browse files Browse the repository at this point in the history
  • Loading branch information
Relintai committed Dec 27, 2023
1 parent 43b14a0 commit 70d3d54
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion modules/gdnative/gdnative/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,18 @@ double GDAPI pandemonium_string_to_double(const pandemonium_string *p_self) {
return self->to_double();
}

pandemonium_real GDAPI pandemonium_string_to_float(const pandemonium_string *p_self) {
float GDAPI pandemonium_string_to_float(const pandemonium_string *p_self) {
const String *self = (const String *)p_self;

return self->to_float();
}

pandemonium_real GDAPI pandemonium_string_to_real(const pandemonium_string *p_self) {
const String *self = (const String *)p_self;

return self->to_real();
}

pandemonium_int GDAPI pandemonium_string_to_int(const pandemonium_string *p_self) {
const String *self = (const String *)p_self;

Expand Down
7 changes: 7 additions & 0 deletions modules/gdnative/gdnative_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -5475,6 +5475,13 @@
},
{
"name": "pandemonium_string_to_float",
"return_type": "float",
"arguments": [
["const pandemonium_string *", "p_self"]
]
},
{
"name": "pandemonium_string_to_real",
"return_type": "pandemonium_real",
"arguments": [
["const pandemonium_string *", "p_self"]
Expand Down
3 changes: 2 additions & 1 deletion modules/gdnative/include/gdn/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ pandemonium_bool GDAPI pandemonium_string_is_numeric(const pandemonium_string *p
pandemonium_bool GDAPI pandemonium_string_is_zero(const pandemonium_string *p_self);

double GDAPI pandemonium_string_to_double(const pandemonium_string *p_self);
pandemonium_real GDAPI pandemonium_string_to_float(const pandemonium_string *p_self);
float GDAPI pandemonium_string_to_float(const pandemonium_string *p_self);
pandemonium_real GDAPI pandemonium_string_to_real(const pandemonium_string *p_self);
pandemonium_int GDAPI pandemonium_string_to_int(const pandemonium_string *p_self);
pandemonium_bool GDAPI pandemonium_string_to_bool(const pandemonium_string *p_self);
uint32_t GDAPI pandemonium_string_to_uint(const pandemonium_string *p_self);
Expand Down

0 comments on commit 70d3d54

Please sign in to comment.