diff options
author | George Marques <george@gmarqu.es> | 2021-03-09 12:30:06 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-03-18 10:18:58 -0300 |
commit | fbfdd5e1104a883c311fddf3a7ed6763f35f3781 (patch) | |
tree | 7b33c141c8959b0fc2e408ee2f40ccc57a561d3f /core | |
parent | 497dab94be3fafd15729dc5380f24af8d2d2ed47 (diff) |
Add functions to retrieve type of a typed Array
Diffstat (limited to 'core')
-rw-r--r-- | core/variant/array.cpp | 16 | ||||
-rw-r--r-- | core/variant/array.h | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 2ad5e1b3b9..707140ba1b 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -547,6 +547,22 @@ void Array::set_typed(uint32_t p_type, const StringName &p_class_name, const Var _p->typed.where = "TypedArray"; } +bool Array::is_typed() const { + return _p->typed.type != Variant::NIL; +} + +uint32_t Array::get_typed_builtin() const { + return _p->typed.type; +} + +StringName Array::get_typed_class_name() const { + return _p->typed.class_name; +} + +Variant Array::get_typed_script() const { + return _p->typed.script; +} + Array::Array(const Array &p_from) { _p = nullptr; _ref(p_from); diff --git a/core/variant/array.h b/core/variant/array.h index 9865f23d32..8b67f7f085 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -113,6 +113,10 @@ public: bool typed_assign(const Array &p_other); void set_typed(uint32_t p_type, const StringName &p_class_name, const Variant &p_script); + bool is_typed() const; + uint32_t get_typed_builtin() const; + StringName get_typed_class_name() const; + Variant get_typed_script() const; Array(const Array &p_from); Array(); ~Array(); |