summaryrefslogtreecommitdiff
path: root/core/dictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/dictionary.cpp')
-rw-r--r--core/dictionary.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index 6204a87054..6770b798f1 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -232,6 +232,20 @@ Error Dictionary::parse_json(const String& p_json) {
return OK;
}
+Dictionary Dictionary::copy() const {
+
+ Dictionary n(is_shared());
+
+ List<Variant> keys;
+ get_key_list(&keys);
+
+ for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
+ n[E->get()]=operator[](E->get());
+ }
+
+ return n;
+}
+
String Dictionary::to_json() const {
return JSON::print(*this);