summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoommetee Ketson <poommetee@protonmail.com>2017-09-12 04:26:33 +0700
committerGitHub <noreply@github.com>2017-09-12 04:26:33 +0700
commit5b3527ec82bc084f52317035cb83123052fb9f9a (patch)
tree4b037a05a0570f571b1380b31c2f74f6ffd5b2d9
parent8e82bf42a870bc0ef8d41203f42a8d7217adf695 (diff)
parentdccb37417cdd9febdc3e2d91dd06642c553c433b (diff)
Merge pull request #11161 from Noshyaar/pr-lenstr
Implement String len()
-rw-r--r--modules/gdscript/gd_functions.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index f0cfdd6258..04752dc71a 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -1177,20 +1177,28 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count,
VALIDATE_ARG_COUNT(1);
switch (p_args[0]->get_type()) {
+ case Variant::STRING: {
+
+ String d = *p_args[0];
+ r_ret = d.length();
+ } break;
case Variant::DICTIONARY: {
+
Dictionary d = *p_args[0];
r_ret = d.size();
} break;
case Variant::ARRAY: {
+
Array d = *p_args[0];
r_ret = d.size();
} break;
case Variant::POOL_BYTE_ARRAY: {
+
PoolVector<uint8_t> d = *p_args[0];
r_ret = d.size();
-
} break;
case Variant::POOL_INT_ARRAY: {
+
PoolVector<int> d = *p_args[0];
r_ret = d.size();
} break;
@@ -1200,14 +1208,14 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count,
r_ret = d.size();
} break;
case Variant::POOL_STRING_ARRAY: {
+
PoolVector<String> d = *p_args[0];
r_ret = d.size();
-
} break;
case Variant::POOL_VECTOR2_ARRAY: {
+
PoolVector<Vector2> d = *p_args[0];
r_ret = d.size();
-
} break;
case Variant::POOL_VECTOR3_ARRAY: {