Skip to main content

Sift

Sift is a library for manipulating arrays. It provides a number of functions for manipulating arrays (lists), dictionaries, and sets.

Sift is comprised of a number of submodules. Each submodule provides a number of functions for manipulating a specific type of data, and can be accessed via their respective names within the Sift module (e.g. Sift.Array.At()), or accessed directly (e.g. local At = require(Sift.Array.At)).

Some methods and modules also have aliases, which can are documented in the corresponding submodule/method's documentation.

See the individual submodule pages for full documentation.

The Luau types Dictionary<K, V>, Array<T> (aliased as List<T>) and Set<T> are exported from the Sift module (e.g. they can be used via Sift.Array<string>), but are also available from Sift.Types.

Types

None

type None = None

Properties

Array

Sift.Array: Array

List

Alias
Sift.List: Array

Dictionary

Sift.Dictionary: Dictionary

Set

Sift.Set: Set

Types

Sift.Types: Types

None

Sift.None: None

Luau can't distinguish between a nil value and a non-existent value. This constant is used to represent a non-existent value. It can be used in methods like Array.Concat or Dictionary.Merge to remove the value from the result.

Functions

isEmpty

since v0.0.1
</>
Sift.isEmpty(
tabletable--

The table to check.

) → boolean--

Whether or not the table is empty.

Checks whether or not a table is empty.

local a = {}
local b = { hello = "world" }

local value = isEmpty(a) -- true
local value = isEmpty(b) -- false

equalObjects

Sift.equalObjects(
......table--

The tables to compare.

) → boolean--

Whether or not the tables are equal.

Compares two or more tables to see if they are equal.

local a = { hello = "world" }
local b = { hello = "world" }

local equal = EqualObjects(a, b) -- true
Show raw api
{
    "functions": [
        {
            "name": "isEmpty",
            "desc": "Checks whether or not a table is empty.\n\n```lua\nlocal a = {}\nlocal b = { hello = \"world\" }\n\nlocal value = isEmpty(a) -- true\nlocal value = isEmpty(b) -- false\n```",
            "params": [
                {
                    "name": "table",
                    "desc": "The table to check.",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the table is empty.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "since": "v0.0.1",
            "source": {
                "line": 22,
                "path": "src/Util/isEmpty.lua"
            }
        },
        {
            "name": "equalObjects",
            "desc": "Compares two or more tables to see if they are equal.\n\n```lua\nlocal a = { hello = \"world\" }\nlocal b = { hello = \"world\" }\n\nlocal equal = EqualObjects(a, b) -- true\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "The tables to compare.",
                    "lua_type": "...table"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the tables are equal.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/Util/equalObjects.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Array",
            "desc": "",
            "lua_type": "Array",
            "source": {
                "line": 38,
                "path": "src/init.lua"
            }
        },
        {
            "name": "List",
            "desc": "",
            "lua_type": "Array",
            "tags": [
                "Alias"
            ],
            "source": {
                "line": 42,
                "path": "src/init.lua"
            }
        },
        {
            "name": "Dictionary",
            "desc": "",
            "lua_type": "Dictionary",
            "source": {
                "line": 45,
                "path": "src/init.lua"
            }
        },
        {
            "name": "Set",
            "desc": "",
            "lua_type": "Set",
            "source": {
                "line": 48,
                "path": "src/init.lua"
            }
        },
        {
            "name": "Types",
            "desc": "",
            "lua_type": "Types",
            "source": {
                "line": 51,
                "path": "src/init.lua"
            }
        },
        {
            "name": "None",
            "desc": "Luau can't distinguish between a nil value and a non-existent value. This\nconstant is used to represent a non-existent value. It can be used in methods\nlike `Array.Concat` or `Dictionary.Merge` to remove the value from the result.",
            "lua_type": "None",
            "source": {
                "line": 10,
                "path": "src/None.lua"
            }
        }
    ],
    "types": [
        {
            "name": "None",
            "desc": "",
            "lua_type": "None",
            "source": {
                "line": 8,
                "path": "src/Types.lua"
            }
        }
    ],
    "name": "Sift",
    "desc": "Sift is a library for manipulating arrays. It provides a number of\nfunctions for manipulating arrays (lists), dictionaries, and sets.\n\nSift is comprised of a number of submodules. Each submodule provides\na number of functions for manipulating a specific type of data, and\ncan be accessed via their respective names within the Sift module\n(e.g. `Sift.Array.At()`), or accessed directly (e.g. `local At = require(Sift.Array.At)`).\n\nSome methods and modules also have aliases, which can are documented in the\ncorresponding submodule/method's documentation.\n\nSee the individual submodule pages for full documentation.\n\nThe Luau types `Dictionary<K, V>`, `Array<T>` (aliased as `List<T>`) and `Set<T>` are exported from the Sift module (e.g. they can be used via `Sift.Array<string>`), but are also available from [Sift.Types].",
    "source": {
        "line": 22,
        "path": "src/init.lua"
    }
}