-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Add a get_or_add
method to Dictionary
#88345
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much identical to master.
doc/classes/Dictionary.xml
Outdated
<argument index="0" name="key" type="Variant" /> | ||
<argument index="1" name="default" type="Variant" default="null" /> | ||
<description> | ||
Gets a value and ensures the key is set. If the [param key] exists in the dictionary, this behaves like [method get]. Otherwise, the [param default] value is inserted into the dictionary and returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my personal annoyance and a few others, param
does not exist in 3.x.
Gets a value and ensures the key is set. If the [param key] exists in the dictionary, this behaves like [method get]. Otherwise, the [param default] value is inserted into the dictionary and returned. | |
Gets a value and ensures the key is set. If the [code]key[/code] exists in the dictionary, this behaves like [method get]. Otherwise, the [code]default[/code] value is inserted into the dictionary and returned. |
f870e7f
to
f37db96
Compare
Since this is a functionally identical backport I'd say to add a co-author to this |
f37db96
to
d4e5370
Compare
This comment was marked as outdated.
This comment was marked as outdated.
d4e5370
to
2b639f1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2b639f1
to
b3f93ad
Compare
Thanks! |
This follows #78095 that adds
get_or_add
method toDictionary
for 3.x branch. This is a very useful function for setting up new parameters into the dictionary or keep using old values from it.