From 70d3d5438674e33ff65787d92a78e67606205779 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 27 Dec 2023 13:48:01 +0100 Subject: [PATCH] Also added the new helper method to the gdnative api. --- modules/gdnative/gdnative/string.cpp | 8 +++++++- modules/gdnative/gdnative_api.json | 7 +++++++ modules/gdnative/include/gdn/string.h | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 49b24aedf..83807ff86 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -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; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index f54a22d37..5ce6629c2 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -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"] diff --git a/modules/gdnative/include/gdn/string.h b/modules/gdnative/include/gdn/string.h index ceab035ee..824a8932c 100644 --- a/modules/gdnative/include/gdn/string.h +++ b/modules/gdnative/include/gdn/string.h @@ -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);