Instance Methodmigueldeicaza.swiftgodot 0.45.0SwiftGodot
merge(dictionary:overwrite:)
Adds entries from dictionary
to this dictionary. By default, duplicate keys are not copied over, unless overwrite
is true
.
final func merge(dictionary: GDictionary, overwrite: Bool = false)
Other members in extension
Typealiases
Type members
init(
) Constructs an empty
GDictionary
.init(alreadyOwnedContent: ContentType
) init(content: ContentType
) init(from: GDictionary
) Returns the same dictionary as
from
. If you need a copy of the dictionary, useduplicate(deep:)
.static var godotType: Variant.GType
static let zero: ContentType
static func != (lhs: GDictionary, rhs: GDictionary
) -> Bool Returns
true
if the two dictionaries do not contain the same keys and values.static func == (lhs: GDictionary, rhs: GDictionary
) -> Bool Returns
true
if the two dictionaries contain the same keys and values. The order of the entries does not matter.
Instance members
var content: ContentType
var debugDescription: String
Renders the dictionary using the
Variant
’sdescription
method.var description: String
Renders the dictionary using the
Variant
’sdescription
method.subscript(StringName
) -> Variant? Convenience subscript that uses a StringName as the key to access the elements in the dictionary. Merely wraps this on a Variant.
subscript(Variant
) -> Variant? subscript(String
) -> Variant? Convenience subscript that uses a String as the key to access the elements in the dictionary. Merely wraps this on a Variant.
func clear(
) Clears the dictionary, removing all entries from it.
func duplicate(deep: Bool
) -> GDictionary Creates and returns a new copy of the dictionary. If
deep
istrue
, innerGDictionary
andGArray
keys and values are also copied, recursively.func erase(key: Variant
) -> Bool Removes the dictionary entry by key, if it exists. Returns
true
if the givenkey
existed in the dictionary, otherwisefalse
.func findKey(value: Variant
) -> Variant Finds and returns the first key whose associated value is equal to
value
, ornull
if it is not found.func get(key: Variant, default: Variant
) -> Variant Returns the corresponding value for the given
key
in the dictionary. If thekey
does not exist, returnsdefault
, ornull
if the parameter is omitted.func has(key: Variant
) -> Bool Returns
true
if the dictionary contains an entry with the givenkey
.func hasAll(keys: GArray
) -> Bool Returns
true
if the dictionary contains all keys in the givenkeys
array.func hash(
) -> Int64 Returns a hashed 32-bit integer value representing the dictionary contents.
func isEmpty(
) -> Bool Returns
true
if the dictionary is empty (its size is0
). See alsosize
.func isReadOnly(
) -> Bool Returns
true
if the dictionary is read-only. SeemakeReadOnly
. Dictionaries are automatically read-only if declared withconst
keyword.func keys(
) -> GArray Returns the list of keys in the dictionary.
func makeReadOnly(
) Makes the dictionary read-only, i.e. disables modification of the dictionary’s contents. Does not apply to nested content, e.g. content of nested dictionaries.
func size(
) -> Int64 Returns the number of entries in the dictionary. Empty dictionaries (
{ }
) always return0
. See alsoisEmpty
.func values(
) -> GArray Returns the list of values in this dictionary.