Collections.Dictionary
(in ./Carbon/Collections/Dictionary.lua)
Provides a set of utilities to operate on dictionary structures.
Most methods here are intended to be called as both OOP-style methods and on pure data objects.
The Dictionary type Differs from the primtive dictionary type by adding methods to it.
It is possible to use these methods with a plain dictionary, just call them in a non-object oriented way:
Dictionary.Keys(dictionary)
Dictionary.ShallowCopy(dictionary)
Inherits OOP.Object, Serializable
Methods
class public Dictionary:New([table data]
)
Returns Dictionary
- optional
data
: The data of the dictionary. Empty if not specified.
Turns the given object into a Dictionary. Allows method-style syntax to be used on the object.
class public Dictionary.DeepCopy(table self, [table to, bool datawise, table map]
)
Returns table
object public Dictionary:DeepCopy([table to, bool datawise, table map]
)
Returns table
- required
self
: The dictionary to source data from. - optional
to
: The dictionary to copy into; an empty table if not given. - optional
datawise
: Whether the copy should ignore Copy member functions. - internal
map
: A map projecting original values into copied values.
Performs a self-reference fixing deep copy from one table into another. Handles self-references properly.
class public Dictionary.DeepCopyMerge(table self, table to
)
Returns table
object public Dictionary:DeepCopyMerge(table to
)
Returns table
- required
self
: The table to source data from. - required
to
: The table to put data into.
Performs a merge into the table, performing a deep copy on all table members.
class public Dictionary.Keys(table self
)
Returns List
object public Dictionary:Keys()
Returns List
- required
self
: The table to retrieve keys for.
Returns all the keys in the table.
class public Dictionary.RawDeepCopyMerge(table self, table to
)
Returns table
object public Dictionary:RawDeepCopyMerge(table to
)
Returns table
- required
self
: The table to source data from. - required
to
: The table to put data into.
Performs a merge into the table, performing a deep copy on all table members and using raw gets.
class public Dictionary.ShallowCopy(table self, [table to]
)
Returns table
object public Dictionary:ShallowCopy([table to]
)
Returns table
- required
self
: The table to source data from - optional
to
: The table to copy into; an empty table if not given.
Shallow copies data from one table into another and returns the result.
class public Dictionary.ShallowMerge(table self, table to
)
Returns table
object public Dictionary:ShallowMerge(table to
)
Returns table
- required
self
: The table to source data from. - required
to
: The table to output into.
Performs a merge into a table without overwriting existing keys.
class public Dictionary.ToSet(table self, [table out]
)
Returns Set
object public Dictionary:ToSet([table out]
)
Returns Set
- required
self
: The table to convert to a set. - optional
out
: Where to put the resulting set. Defaults to a new set.
Converts the Dictionary to a Set.
class public Dictionary.Values(table self
)
Returns List
object public Dictionary:Values()
Returns List
- required
self
: The table to retrieve values for.
Returns all the values in the table in a List
Properties
[none]