Skip to main content

Dictionary

Dictionaries are a type of data structure that can be used to store key-value pairs.

local dictionary = {
	cats = 2,
	dogs = 1
}

print(dictionary.cats) -- 2

Functions

copy

Dictionary.copy(
dictionaryT--

The dictionary to copy.

) → T--

The copied dictionary.

Copies a dictionary.

local dictionary = { hello = "world" }

local new = Copy(dictionary) -- { hello = "world" }

print(new == dictionary) -- false
print(new.hello == dictionary.hello) -- true

update

Dictionary.update(
dictionary{[K]V?},--

The dictionary to update.

keyK,--

The key to update.

updater?(
valueV,
keyK
) → U,--

The updater function.

callback?(keyK) → C--

The callback function.

) → {[K]V | U | C}--

The updated dictionary.

Updates a value in a dictionary at the given key. If the value at the given key does not exist, callback will be called, and its return value will be used as the value at the given key.

local dictionary = { cats = 2 }

local new = Update(dictionary, "cats", function(value)
  return value + 1
end) -- { cats = 3 }

local new = Update(dictionary, "dogs", function(value)
  return value + 1
end, function(value)
  return 1
end) -- { cats = 3, dogs = 1 }

map

Dictionary.map(
dictionary{[K]V},--

The dictionary to map.

mapper(
valueV,
keyK,
dictionary{[K]V}
) → (
Y?,
X?
)--

The mapper function.

) → {[X]Y}--

The mapped dictionary.

Maps the dictionary using the mapper function. The mapper function can return a value and a key. If the mapper function does not return a key, the original key will be used.

local dictionary = { hello = 10, goodbye = 20 }

local new = Map(dictionary, function(value, key)
  return value * 2, key .. "!"
end) -- { ["hello!"] = 20, ["goodbye!"] = 40 }

local new = Map(dictionary, function(value, key)
  return value * 10
end) -- { hello = 100, goodbye = 200 }

flatten

Dictionary.flatten(
dictionaryT,--

The dictionary to flatten.

depth?number--

The depth to flatten the dictionary to.

) → T--

The flattened dictionary.

Flattens a dictionary. If depth is not specified, it will flatten the dictionary as far as it can go.

local dictionary = {
  hello = "world",
  goodbye = {
    world = "hello",
    roblox = {
      yes = "no",
      no = "yes",
    }
  }
}

local new = Flatten(dictionary) -- { hello = "world", world = "hello", yes = "no", no = "yes" }
local new = Flatten(dictionary, 1) -- { hello = "world", world = "hello", roblox = { yes = "no", no = "yes" } }

includes

Dictionary.includes(
dictionary{[K]V},--

The dictionary to check.

valueV--

The value to check for.

) → boolean--

Whether or not the dictionary includes the given value.

Checks whether or not the given dictionary includes the given value.

local dictionary = { hello = "roblox", goodbye = "world" }

local includesRoblox = Includes(dictionary, "roblox") -- true
local includesCat = Includes(dictionary, "cat") -- false

removeValues

Dictionary.removeValues(
dictionary{[K]V},--

The dictionary to remove the values from.

values...V--

The values to remove.

) → {[K]V}--

The dictionary without the given values.

Removes the given values from the given dictionary.

local dictionary = { hello = "world", cat = "meow", unicorn = "rainbow", goodbye = "world" }

local withoutWorld = RemoveValues(dictionary, "world") -- { cat = "meow", unicorn = "rainbow" }
local onlyWorld = RemoveValues(dictionary, "meow", "rainbow") -- { hello = "world", goodbye = "world" }

mergeDeep

Dictionary.mergeDeep(
dictionaries?...any--

The dictionaries to merge.

) → T--

The merged dictionary.

Merges the given dictionaries into a single dictionary. If the value is None, it will be removed from the result. This is recursive. The parameters may be any number of dictionaries or nil. Non-dictonaries will be ignored.

Aliases: joinDeep

local dictionary1 = { hello = "roblox", goodbye = { world = "goodbye" } }
local dictionary2 = { goodbye = { world = "world" } }

local merged = MergeDeep(dictionary1, dictionary2) -- { hello = "roblox", goodbye = { world = "world" } }

removeValue

Dictionary.removeValue(
dictionary{[K]V},--

The dictionary to remove the value from.

valueV--

The value to remove.

) → {[K]V}--

The dictionary without the given value.

Removes the given value from the given dictionary.

local dictionary = { hello = "roblox", goodbye = "world" }

local withoutHello = RemoveValue(dictionary, "roblox") -- { goodbye = "world" }
local withoutGoodbye = RemoveValue(dictionary, "world") -- { hello = "roblox" }

merge

Dictionary.merge(
dictionaries?...any--

The dictionaries to merge.

) → T--

The merged dictionary.

Merges the given dictionaries into a single dictionary. If the value is None, it will be removed from the result. The parameters may be any number of dictionaries or nil. Non-dictonaries will be ignored.

Aliases: join

local dictionary1 = { hello = "roblox", goodbye = "world" }
local dictionary2 = { goodbye = "goodbye" }

local merged = Merge(dictionary1, dictionary2) -- { hello = "roblox", goodbye = "goodbye" }

filter

Dictionary.filter(
dictionary{[K]V},--

The dictionary to filter.

predicate?(
valueV,
keyK,
dictionary{[K]V}
) → any--

The predicate to use to filter the dictionary.

) → {[K]V}--

The filtered dictionary.

Filters a dictionary using a predicate. Any items that do not pass the predicate will be removed from the dictionary.

local dictionary = { hello = "world", goodbye = "goodbye" }

local result = Filter(dictionary, function(value, key)
  return value == "world"
end) -- { hello = "world" }

every

Dictionary.every(
dictionary{[K]V},--

The dictionary to check.

predicate(
valueV,
keyK,
dictionary{[K]V}
) → any--

The predicate to use to check the dictionary.

) → boolean--

Whether every item in the dictionary passes the predicate.

Checks whether every item in the dictionary passes the predicate.

local dictionary = { hello = "world", goodbye = "world" }

local value = Every(dictionary, function(value, key)
  return value == "world"
end) -- true

local value = Every(dictionary, function(value, key)
  return value == "hello"
end) -- false

values

Dictionary.values(
dictionary{[K]V}--

The dictionary to get the values from.

) → {V}--

The values in the dictionary.

Gets the values in the given dictionary.

local dictionary = { hello = "roblox", goodbye = "world" }

local values = Values(dictionary) -- { "roblox", "world" }

copyDeep

Dictionary.copyDeep(
dictionaryT--

The dictionary to copy.

) → T--

The copied dictionary.

Copies a dictionary recursively.

local dictionary = { hello = { world = "goodbye" } }

local new = CopyDeep(dictionary) -- { hello = { world = "goodbye" } }

print(new == dictionary) -- false
print(new.hello == dictionary.hello) -- false

fromEntries

Dictionary.fromEntries(
entries{{
K,
V
}}--

An array of key-value pairs.

) → {[K]V}--

A dictionary composed of the given key-value pairs.

Creates a dictionary from the given key-value pairs.

local entries = { { "hello", "roblox" }, { "goodbye", "world" } }

local dictionary = FromEntries(entries) -- { hello = "roblox", goodbye = "world" }

removeKey

Dictionary.removeKey(
dictionary{[K]V},--

The dictionary to remove the key from.

keyK--

The key to remove.

) → {[K]V}--

The dictionary without the given key.

Removes the given key from the given dictionary.

local dictionary = { hello = "roblox", goodbye = "world" }

local withoutHello = RemoveKey(dictionary, "hello") -- { goodbye = "world" }
local withoutGoodbye = RemoveKey(dictionary, "goodbye") -- { hello = "roblox" }

equalsDeep

Dictionary.equalsDeep(
......{[any]any}--

The dictionaries to compare.

) → boolean--

Whether the dictionaries are equal.

Compares two dictionaries for equality using deep comparison.

local dictionary = { hello = "world", goodbye = { world = "hello" } }
local other1 = { hello = "world", goodbye = { world = "hello" } }
local other2 = { hello = "hello", world = "goodbye" }

local value = EqualsDeep(dictionary, other1) -- true
local value = EqualsDeep(dictionary, other1, other2) -- false

freeze

Dictionary.freeze(
dictionaryT--

The dictionary to freeze.

) → T--

The frozen dictionary.

Freezes the given dictionary at the top level, making it read-only.

local dictionary = { hello = "roblox", goodbye = { world = "world" } }

local new = Freeze(dictionary)

new.hello = "world" -- error!
new.goodbye.world = "hello" -- still works!

fromArrays

Dictionary.fromArrays(
keys{K},--

An array containing values to be used as keys.

values{V}--

An array containing values to be used as values.

) → {[K]V}--

A dictionary composed of the given keys and values.

Creates a dictionary from the given arrays, where the first array is used as keys and the second array is used as values.

local keys = { "hello", "goodbye" }
local values = { "roblox", "world" }

local dictionary = FromArrays(keys, values) -- { hello = "roblox", goodbye = "world" }

set

Dictionary.set(
dictionary{[K]V},--

The dictionary to set the value in.

keyK,--

The key to set the value in.

valueV--

The value to set.

) → {[K]V}--

The dictionary with the given value set.

Sets the given value in the given dictionary.

local dictionary = { hello = "world", cat = "meow", unicorn = "rainbow" }

local setCat = Set(dictionary, "cat", "woof") -- { hello = "world", cat = "woof", unicorn = "rainbow" }

count

Dictionary.count(
dictionaryT,--

The dictionary to count.

predicate?(
valueT,
keyK,
dictionaryT
) → any--

The predicate to use to filter the dictionary.

) → number--

The number of items in the dictionary.

Counts the number of items in a dictionary.

local dictionary = { hello = "world", goodbye = "world" }

local value = Count(dictionary) -- 2
local value = Count(dictionary, function(item, key)
  return item == "world"
end) -- 1

keys

Dictionary.keys(
dictionary{[K]V}--

The dictionary to get the keys of.

) → {K}--

An array containing the keys of the given dictionary.

Gets the keys of the given dictionary as an array.

local dictionary = { hello = "roblox", goodbye = "world" }

local keys = Keys(dictionary) -- { "hello", "goodbye" }

flip

Dictionary.flip(
dictionary{[K]V}--

The dictionary to flip.

) → {[V]K}--

The flipped dictionary.

Flips a dictionary. Keys become values and values become keys.

local dictionary = { hello = "roblox", goodbye = "world" }

local new = Flip(dictionary) -- { world = "goodbye", roblox = "hello" }

withKeys

Dictionary.withKeys(
dictionary{[K]V},--

The dictionary to select the keys from.

keys...K--

The keys to keep.

) → {[K]V}--

The dictionary with only the given keys.

Returns a dictionary with the given keys.

local dictionary = { hello = "world", cat = "meow", dog = "woof", unicorn = "rainbow" }

local withoutCatDog = WithKeys(dictionary, "cat", "dog") -- { cat = "meow", dog = "woof" }

equals

Dictionary.equals(
......{[any]any}--

The dictionaries to compare.

) → boolean--

Whether the dictionaries are equal.

Compares two dictionaries for equality.

local dictionary = { hello = "world", goodbye = "world" }
local other1 = { hello = "world", goodbye = "world" }
local other2 = { hello = "hello", world = "goodbye" }

local value = Equals(dictionary, other1) -- true
local value = Equals(dictionary, other1, other2) -- false

removeKeys

Dictionary.removeKeys(
dictionary{[K]V},--

The dictionary to remove the keys from.

keys...K--

The keys to remove.

) → {[K]V}--

The dictionary without the given keys.

Removes the given keys from the given dictionary.

local dictionary = { hello = "world", cat = "meow", dog = "woof", unicorn = "rainbow" }

local withoutCatDog = RemoveKeys(dictionary, "cat", "dog") -- { hello = "world", unicorn = "rainbow" }

has

Dictionary.has(
dictionary{[K]V},--

The dictionary to check.

keyany--

The key to check for.

) → boolean--

Whether or not the dictionary has the given key.

Checks whether or not the given dictionary has the given key.

local dictionary = { hello = "roblox", goodbye = "world" }

local hasHello = Has(dictionary, "hello") -- true
local hasCat = Has(dictionary, "cat") -- false

entries

Dictionary.entries(
dictionary{[K]V}--

The dictionary to get the entries from.

) → {{
K,
V
}}--

The entries in the dictionary.

Returns the entries in the given dictionary as an array of key-value pairs.

local dictionary = { hello = "roblox", goodbye = "world" }

local entries = Entries(dictionary) -- { { "hello", "roblox" }, { "goodbye", "world" } }

some

Dictionary.some(
dictionary{[K]V},--

The dictionary to check.

predicate(
valueV,
keyK,
dictionary{[K]V}
) → any--

The predicate to check against.

) → boolean--

Whether or not the predicate returned true for any value.

Checks whether or not the predicate returned true for any value in the dictionary.

local dictionary = { hello = "world", cat = "meow", unicorn = "rainbow" }

local hasMeow = Some(dictionary, function(value)
  return value == "meow"
end) -- true

local hasDog = Some(dictionary, function(_, key)
  return key == "dog"
end) -- false

freezeDeep

Dictionary.freezeDeep(
dictionaryT--

The dictionary to freeze.

) → T--

The frozen dictionary.

Freezes the entire dictionary, making it read-only, including all nested dictionaries.

local dictionary = { hello = "roblox", goodbye = { world = "world" } }

local new = FreezeDeep(dictionary)

new.hello = "world" -- error!
new.goodbye.world = "hello" -- error!
Show raw api
{
    "functions": [
        {
            "name": "copy",
            "desc": "Copies a dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\" }\n\nlocal new = Copy(dictionary) -- { hello = \"world\" }\n\nprint(new == dictionary) -- false\nprint(new.hello == dictionary.hello) -- true\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to copy.",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "The copied dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/Dictionary/copy.lua"
            }
        },
        {
            "name": "update",
            "desc": "Updates a value in a dictionary at the given key. If the value at the given key does not exist, `callback` will be called, and its return value will be used as the value at the given key.\n\n```lua\nlocal dictionary = { cats = 2 }\n\nlocal new = Update(dictionary, \"cats\", function(value)\n  return value + 1\nend) -- { cats = 3 }\n\nlocal new = Update(dictionary, \"dogs\", function(value)\n  return value + 1\nend, function(value)\n  return 1\nend) -- { cats = 3, dogs = 1 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to update.",
                    "lua_type": "{[K]: V?}"
                },
                {
                    "name": "key",
                    "desc": "The key to update.",
                    "lua_type": "K"
                },
                {
                    "name": "updater?",
                    "desc": "The updater function.",
                    "lua_type": "(value: V, key: K) -> U"
                },
                {
                    "name": "callback?",
                    "desc": "The callback function.",
                    "lua_type": "(key: K) -> C"
                }
            ],
            "returns": [
                {
                    "desc": "The updated dictionary.",
                    "lua_type": "{[K]: V | U | C}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "src/Dictionary/update.lua"
            }
        },
        {
            "name": "map",
            "desc": "Maps the dictionary using the mapper function. The mapper function can\nreturn a value and a key. If the mapper function does not return a key,\nthe original key will be used.\n\n```lua\nlocal dictionary = { hello = 10, goodbye = 20 }\n\nlocal new = Map(dictionary, function(value, key)\n  return value * 2, key .. \"!\"\nend) -- { [\"hello!\"] = 20, [\"goodbye!\"] = 40 }\n\nlocal new = Map(dictionary, function(value, key)\n  return value * 10\nend) -- { hello = 100, goodbye = 200 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to map.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "mapper",
                    "desc": "The mapper function.",
                    "lua_type": "(value: V, key: K, dictionary: {[K]: V}) -> (Y?, X?)"
                }
            ],
            "returns": [
                {
                    "desc": "The mapped dictionary.",
                    "lua_type": "{[X]: Y}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 26,
                "path": "src/Dictionary/map.lua"
            }
        },
        {
            "name": "flatten",
            "desc": "Flattens a dictionary. If depth is not specified, it will flatten the dictionary as far as it can go.\n\n```lua\nlocal dictionary = {\n  hello = \"world\",\n  goodbye = {\n    world = \"hello\",\n    roblox = {\n      yes = \"no\",\n      no = \"yes\",\n    }\n  }\n}\n\nlocal new = Flatten(dictionary) -- { hello = \"world\", world = \"hello\", yes = \"no\", no = \"yes\" }\nlocal new = Flatten(dictionary, 1) -- { hello = \"world\", world = \"hello\", roblox = { yes = \"no\", no = \"yes\" } }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to flatten.",
                    "lua_type": "T"
                },
                {
                    "name": "depth?",
                    "desc": "The depth to flatten the dictionary to.",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "The flattened dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "src/Dictionary/flatten.lua"
            }
        },
        {
            "name": "includes",
            "desc": "Checks whether or not the given dictionary includes the given value.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal includesRoblox = Includes(dictionary, \"roblox\") -- true\nlocal includesCat = Includes(dictionary, \"cat\") -- false\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to check.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "value",
                    "desc": "The value to check for.",
                    "lua_type": "V"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the dictionary includes the given value.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 19,
                "path": "src/Dictionary/includes.lua"
            }
        },
        {
            "name": "removeValues",
            "desc": "Removes the given values from the given dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\", cat = \"meow\", unicorn = \"rainbow\", goodbye = \"world\" }\n\nlocal withoutWorld = RemoveValues(dictionary, \"world\") -- { cat = \"meow\", unicorn = \"rainbow\" }\nlocal onlyWorld = RemoveValues(dictionary, \"meow\", \"rainbow\") -- { hello = \"world\", goodbye = \"world\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to remove the values from.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "values",
                    "desc": "The values to remove.",
                    "lua_type": "...V"
                }
            ],
            "returns": [
                {
                    "desc": "The dictionary without the given values.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "src/Dictionary/removeValues.lua"
            }
        },
        {
            "name": "mergeDeep",
            "desc": "Merges the given dictionaries into a single dictionary. If the\nvalue is `None`, it will be removed from the result. This is\nrecursive. The parameters may be any number of dictionaries or\n`nil`. Non-dictonaries will be ignored.\n\nAliases: `joinDeep`\n\n```lua\nlocal dictionary1 = { hello = \"roblox\", goodbye = { world = \"goodbye\" } }\nlocal dictionary2 = { goodbye = { world = \"world\" } }\n\nlocal merged = MergeDeep(dictionary1, dictionary2) -- { hello = \"roblox\", goodbye = { world = \"world\" } }\n```",
            "params": [
                {
                    "name": "dictionaries?",
                    "desc": "The dictionaries to merge.",
                    "lua_type": "...any"
                }
            ],
            "returns": [
                {
                    "desc": "The merged dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 28,
                "path": "src/Dictionary/mergeDeep.lua"
            }
        },
        {
            "name": "removeValue",
            "desc": "Removes the given value from the given dictionary.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal withoutHello = RemoveValue(dictionary, \"roblox\") -- { goodbye = \"world\" }\nlocal withoutGoodbye = RemoveValue(dictionary, \"world\") -- { hello = \"roblox\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to remove the value from.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "value",
                    "desc": "The value to remove.",
                    "lua_type": "V"
                }
            ],
            "returns": [
                {
                    "desc": "The dictionary without the given value.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 19,
                "path": "src/Dictionary/removeValue.lua"
            }
        },
        {
            "name": "merge",
            "desc": "Merges the given dictionaries into a single dictionary. If the\nvalue is `None`, it will be removed from the result. The\nparameters may be any number of dictionaries or `nil`.\nNon-dictonaries will be ignored.\n\nAliases: `join`\n\n```lua\nlocal dictionary1 = { hello = \"roblox\", goodbye = \"world\" }\nlocal dictionary2 = { goodbye = \"goodbye\" }\n\nlocal merged = Merge(dictionary1, dictionary2) -- { hello = \"roblox\", goodbye = \"goodbye\" }\n```",
            "params": [
                {
                    "name": "dictionaries?",
                    "desc": "The dictionaries to merge.",
                    "lua_type": "...any"
                }
            ],
            "returns": [
                {
                    "desc": "The merged dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 27,
                "path": "src/Dictionary/merge.lua"
            }
        },
        {
            "name": "filter",
            "desc": "Filters a dictionary using a predicate. Any items that do not pass the predicate will be removed from the dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\", goodbye = \"goodbye\" }\n\nlocal result = Filter(dictionary, function(value, key)\n  return value == \"world\"\nend) -- { hello = \"world\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to filter.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "predicate?",
                    "desc": "The predicate to use to filter the dictionary.",
                    "lua_type": "(value: V, key: K, dictionary: {[K]: V}) -> any"
                }
            ],
            "returns": [
                {
                    "desc": "The filtered dictionary.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "src/Dictionary/filter.lua"
            }
        },
        {
            "name": "every",
            "desc": "Checks whether every item in the dictionary passes the predicate.\n\n```lua\nlocal dictionary = { hello = \"world\", goodbye = \"world\" }\n\nlocal value = Every(dictionary, function(value, key)\n  return value == \"world\"\nend) -- true\n\nlocal value = Every(dictionary, function(value, key)\n  return value == \"hello\"\nend) -- false\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to check.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "predicate",
                    "desc": "The predicate to use to check the dictionary.",
                    "lua_type": "(value: V, key: K, dictionary: {[K]: V}) -> any"
                }
            ],
            "returns": [
                {
                    "desc": "Whether every item in the dictionary passes the predicate.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "src/Dictionary/every.lua"
            }
        },
        {
            "name": "values",
            "desc": "Gets the values in the given dictionary.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal values = Values(dictionary) -- { \"roblox\", \"world\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to get the values from.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "returns": [
                {
                    "desc": "The values in the dictionary.",
                    "lua_type": "{V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Dictionary/values.lua"
            }
        },
        {
            "name": "copyDeep",
            "desc": "Copies a dictionary recursively.\n\n```lua\nlocal dictionary = { hello = { world = \"goodbye\" } }\n\nlocal new = CopyDeep(dictionary) -- { hello = { world = \"goodbye\" } }\n\nprint(new == dictionary) -- false\nprint(new.hello == dictionary.hello) -- false\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to copy.",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "The copied dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/Dictionary/copyDeep.lua"
            }
        },
        {
            "name": "fromEntries",
            "desc": "Creates a dictionary from the given key-value pairs.\n\n```lua\nlocal entries = { { \"hello\", \"roblox\" }, { \"goodbye\", \"world\" } }\n\nlocal dictionary = FromEntries(entries) -- { hello = \"roblox\", goodbye = \"world\" }\n```",
            "params": [
                {
                    "name": "entries",
                    "desc": "An array of key-value pairs.",
                    "lua_type": "{{ K, V }}"
                }
            ],
            "returns": [
                {
                    "desc": "A dictionary composed of the given key-value pairs.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Dictionary/fromEntries.lua"
            }
        },
        {
            "name": "removeKey",
            "desc": "Removes the given key from the given dictionary.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal withoutHello = RemoveKey(dictionary, \"hello\") -- { goodbye = \"world\" }\nlocal withoutGoodbye = RemoveKey(dictionary, \"goodbye\") -- { hello = \"roblox\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to remove the key from.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "key",
                    "desc": "The key to remove.",
                    "lua_type": "K"
                }
            ],
            "returns": [
                {
                    "desc": "The dictionary without the given key.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "src/Dictionary/removeKey.lua"
            }
        },
        {
            "name": "equalsDeep",
            "desc": "Compares two dictionaries for equality using deep comparison.\n\n```lua\nlocal dictionary = { hello = \"world\", goodbye = { world = \"hello\" } }\nlocal other1 = { hello = \"world\", goodbye = { world = \"hello\" } }\nlocal other2 = { hello = \"hello\", world = \"goodbye\" }\n\nlocal value = EqualsDeep(dictionary, other1) -- true\nlocal value = EqualsDeep(dictionary, other1, other2) -- false\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "The dictionaries to compare.",
                    "lua_type": "...{ [any]: any }"
                }
            ],
            "returns": [
                {
                    "desc": "Whether the dictionaries are equal.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 45,
                "path": "src/Dictionary/equalsDeep.lua"
            }
        },
        {
            "name": "freeze",
            "desc": "Freezes the given dictionary at the top level, making it read-only.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = { world = \"world\" } }\n\nlocal new = Freeze(dictionary)\n\nnew.hello = \"world\" -- error!\nnew.goodbye.world = \"hello\" -- still works!\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to freeze.",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "The frozen dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "src/Dictionary/freeze.lua"
            }
        },
        {
            "name": "fromArrays",
            "desc": "Creates a dictionary from the given arrays, where the first array is used\nas keys and the second array is used as values.\n\n```lua\nlocal keys = { \"hello\", \"goodbye\" }\nlocal values = { \"roblox\", \"world\" }\n\nlocal dictionary = FromArrays(keys, values) -- { hello = \"roblox\", goodbye = \"world\" }\n```",
            "params": [
                {
                    "name": "keys",
                    "desc": "An array containing values to be used as keys.",
                    "lua_type": "{K}"
                },
                {
                    "name": "values",
                    "desc": "An array containing values to be used as values.",
                    "lua_type": "{V}"
                }
            ],
            "returns": [
                {
                    "desc": "A dictionary composed of the given keys and values.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/Dictionary/fromArrays.lua"
            }
        },
        {
            "name": "set",
            "desc": "Sets the given value in the given dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\", cat = \"meow\", unicorn = \"rainbow\" }\n\nlocal setCat = Set(dictionary, \"cat\", \"woof\") -- { hello = \"world\", cat = \"woof\", unicorn = \"rainbow\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to set the value in.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "key",
                    "desc": "The key to set the value in.",
                    "lua_type": "K"
                },
                {
                    "name": "value",
                    "desc": "The value to set.",
                    "lua_type": "V"
                }
            ],
            "returns": [
                {
                    "desc": "The dictionary with the given value set.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "src/Dictionary/set.lua"
            }
        },
        {
            "name": "count",
            "desc": "Counts the number of items in a dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\", goodbye = \"world\" }\n\nlocal value = Count(dictionary) -- 2\nlocal value = Count(dictionary, function(item, key)\n  return item == \"world\"\nend) -- 1\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to count.",
                    "lua_type": "T"
                },
                {
                    "name": "predicate?",
                    "desc": "The predicate to use to filter the dictionary.",
                    "lua_type": "(value: T, key: K, dictionary: T) -> any"
                }
            ],
            "returns": [
                {
                    "desc": "The number of items in the dictionary.",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 25,
                "path": "src/Dictionary/count.lua"
            }
        },
        {
            "name": "keys",
            "desc": "Gets the keys of the given dictionary as an array.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal keys = Keys(dictionary) -- { \"hello\", \"goodbye\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to get the keys of.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "returns": [
                {
                    "desc": "An array containing the keys of the given dictionary.",
                    "lua_type": "{K}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Dictionary/keys.lua"
            }
        },
        {
            "name": "flip",
            "desc": "Flips a dictionary. Keys become values and values become keys.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal new = Flip(dictionary) -- { world = \"goodbye\", roblox = \"hello\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to flip.",
                    "lua_type": "{ [K]: V }"
                }
            ],
            "returns": [
                {
                    "desc": "The flipped dictionary.",
                    "lua_type": "{ [V]: K }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Dictionary/flip.lua"
            }
        },
        {
            "name": "withKeys",
            "desc": "Returns a dictionary with the given keys.\n\n```lua\nlocal dictionary = { hello = \"world\", cat = \"meow\", dog = \"woof\", unicorn = \"rainbow\" }\n\nlocal withoutCatDog = WithKeys(dictionary, \"cat\", \"dog\") -- { cat = \"meow\", dog = \"woof\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to select the keys from.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "keys",
                    "desc": "The keys to keep.",
                    "lua_type": "...K"
                }
            ],
            "returns": [
                {
                    "desc": "The dictionary with only the given keys.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 19,
                "path": "src/Dictionary/withKeys.lua"
            }
        },
        {
            "name": "equals",
            "desc": "Compares two dictionaries for equality.\n\n```lua\nlocal dictionary = { hello = \"world\", goodbye = \"world\" }\nlocal other1 = { hello = \"world\", goodbye = \"world\" }\nlocal other2 = { hello = \"hello\", world = \"goodbye\" }\n\nlocal value = Equals(dictionary, other1) -- true\nlocal value = Equals(dictionary, other1, other2) -- false\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "The dictionaries to compare.",
                    "lua_type": "...{ [any]: any }"
                }
            ],
            "returns": [
                {
                    "desc": "Whether the dictionaries are equal.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 45,
                "path": "src/Dictionary/equals.lua"
            }
        },
        {
            "name": "removeKeys",
            "desc": "Removes the given keys from the given dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\", cat = \"meow\", dog = \"woof\", unicorn = \"rainbow\" }\n\nlocal withoutCatDog = RemoveKeys(dictionary, \"cat\", \"dog\") -- { hello = \"world\", unicorn = \"rainbow\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to remove the keys from.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "keys",
                    "desc": "The keys to remove.",
                    "lua_type": "...K"
                }
            ],
            "returns": [
                {
                    "desc": "The dictionary without the given keys.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/Dictionary/removeKeys.lua"
            }
        },
        {
            "name": "has",
            "desc": "Checks whether or not the given dictionary has the given key.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal hasHello = Has(dictionary, \"hello\") -- true\nlocal hasCat = Has(dictionary, \"cat\") -- false\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to check.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "key",
                    "desc": "The key to check for.",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the dictionary has the given key.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "src/Dictionary/has.lua"
            }
        },
        {
            "name": "entries",
            "desc": "Returns the entries in the given dictionary as an array of key-value pairs.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = \"world\" }\n\nlocal entries = Entries(dictionary) -- { { \"hello\", \"roblox\" }, { \"goodbye\", \"world\" } }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to get the entries from.",
                    "lua_type": "{[K]: V}"
                }
            ],
            "returns": [
                {
                    "desc": "The entries in the dictionary.",
                    "lua_type": "{{ K, V }}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Dictionary/entries.lua"
            }
        },
        {
            "name": "some",
            "desc": "Checks whether or not the predicate returned true for any value in the dictionary.\n\n```lua\nlocal dictionary = { hello = \"world\", cat = \"meow\", unicorn = \"rainbow\" }\n\nlocal hasMeow = Some(dictionary, function(value)\n  return value == \"meow\"\nend) -- true\n\nlocal hasDog = Some(dictionary, function(_, key)\n  return key == \"dog\"\nend) -- false\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to check.",
                    "lua_type": "{[K]: V}"
                },
                {
                    "name": "predicate",
                    "desc": "The predicate to check against.",
                    "lua_type": "(value: V, key: K, dictionary: { [K]: V }) -> any"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the predicate returned true for any value.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "src/Dictionary/some.lua"
            }
        },
        {
            "name": "freezeDeep",
            "desc": "Freezes the entire dictionary, making it read-only, including all nested dictionaries.\n\n```lua\nlocal dictionary = { hello = \"roblox\", goodbye = { world = \"world\" } }\n\nlocal new = FreezeDeep(dictionary)\n\nnew.hello = \"world\" -- error!\nnew.goodbye.world = \"hello\" -- error!\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "The dictionary to freeze.",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "The frozen dictionary.",
                    "lua_type": "T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 22,
                "path": "src/Dictionary/freezeDeep.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Dictionary",
    "desc": "Dictionaries are a type of data structure that can be used to store key-value pairs.\n\n```lua\nlocal dictionary = {\n\tcats = 2,\n\tdogs = 1\n}\n\nprint(dictionary.cats) -- 2\n```",
    "source": {
        "line": 16,
        "path": "src/Dictionary/init.lua"
    }
}