summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebastian-heinz <sebastian.heinz.gt@googlemail.com>2021-12-02 15:30:10 +0800
committersebastian-heinz <sebastian.heinz.gt@googlemail.com>2021-12-02 15:30:10 +0800
commitbe90aadbcd2bb7ca4e5d29b1616f326dffce9524 (patch)
treeb5b424e1d6edaf40018181317cec324ea1447471
parentcd05653e308c2263e23debd45211c48af134040d (diff)
downloadredot-engine-be90aadbcd2bb7ca4e5d29b1616f326dffce9524.tar.gz
allow variant construction in expressions
-rw-r--r--core/math/expression.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index f7ac44d321..c8086ce419 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -410,6 +410,14 @@ Error Expression::_get_token(Token &r_token) {
} else if (id == "self") {
r_token.type = TK_SELF;
} else {
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ if (id == Variant::get_type_name(Variant::Type(i))) {
+ r_token.type = TK_BASIC_TYPE;
+ r_token.value = i;
+ return OK;
+ }
+ }
+
if (Variant::has_utility_function(id)) {
r_token.type = TK_BUILTIN_FUNC;
r_token.value = id;