mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-09 00:25:34 +00:00
Add Dictionary.merge()
This commit is contained in:
@@ -269,6 +269,14 @@ void Dictionary::clear() {
|
||||
_p->variant_map.clear();
|
||||
}
|
||||
|
||||
void Dictionary::merge(const Dictionary &p_dictionary, bool p_overwrite) {
|
||||
for (const KeyValue<Variant, Variant> &E : p_dictionary._p->variant_map) {
|
||||
if (p_overwrite || !has(E.key)) {
|
||||
this->operator[](E.key) = E.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dictionary::_unref() const {
|
||||
ERR_FAIL_COND(!_p);
|
||||
if (_p->refcount.unref()) {
|
||||
|
||||
Reference in New Issue
Block a user