diff options
| author | Juan Linietsky | 2016-08-02 19:11:05 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2016-08-02 19:11:05 -0300 |
| commit | ad313097ebcb2a0c02c956fdf74a6610c3f7c9a8 (patch) | |
| tree | 2c02ecaaa80bfdcf01e4061f27b808e748cdc580 /core/dictionary.cpp | |
| parent | 221cb58382ae34d4f91d9923fd979a328feabace (diff) | |
| download | godot-ad313097ebcb2a0c02c956fdf74a6610c3f7c9a8.tar.gz godot-ad313097ebcb2a0c02c956fdf74a6610c3f7c9a8.tar.zst godot-ad313097ebcb2a0c02c956fdf74a6610c3f7c9a8.zip | |
Diffstat (limited to 'core/dictionary.cpp')
| -rw-r--r-- | core/dictionary.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/dictionary.cpp b/core/dictionary.cpp index 6204a8705..6770b798f 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); |
