1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[3.x] Add a get_or_add method to Dictionary

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
This commit is contained in:
SysError99
2024-02-15 05:03:39 +07:00
parent 354404db60
commit b3f93ad127
4 changed files with 20 additions and 0 deletions

View File

@@ -559,6 +559,7 @@ struct _VariantCall {
VCALL_LOCALMEM0R(Dictionary, values);
VCALL_LOCALMEM1R(Dictionary, duplicate);
VCALL_LOCALMEM2R(Dictionary, get);
VCALL_LOCALMEM2R(Dictionary, get_or_add);
VCALL_LOCALMEM2(Array, set);
VCALL_LOCALMEM1R(Array, get);
@@ -1944,6 +1945,7 @@ void register_variant_methods() {
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, values, varray());
ADDFUNC1R(DICTIONARY, DICTIONARY, Dictionary, duplicate, BOOL, "deep", varray(false));
ADDFUNC2R(DICTIONARY, NIL, Dictionary, get, NIL, "key", NIL, "default", varray(Variant()));
ADDFUNC2R(DICTIONARY, NIL, Dictionary, get_or_add, NIL, "key", NIL, "default", varray(Variant()));
ADDFUNC0R(ARRAY, INT, Array, size, varray());
ADDFUNC0R(ARRAY, BOOL, Array, empty, varray());