Skip to main content

Board

This class is used to create a new leaderboard board.

Types

BoardArguments

interface BoardArguments {
_boardKeystring
_storeUsingstring
_threads{thread}
}

Object

interface Object {
__indexObject
Update(
selfBoard,
userIdnumber,
valuenumber | (number) → (number)
) → Promise.TypedPromise<boolean>
Get(
selfBoard,
amountnumber,
sortDirectionstring
) → Promise.TypedPromise<{TopData}>
Destroy(selfBoard) → ()
new(
boardKeystring,
leaderboardTypeLeaderboardType,
rollingExpirynumber?,
debugModeboolean?
) → Board
}

Functions

new

Board.new(
boardKeystring,
leaderboardTypeLeaderboardType,
rollingExpirynumber?,
debugModeboolean?
) → Board

Types

type LeaderboardType = "Hourly" | "Daily" | "Weekly" | "Monthly" | "Yearly" | "AllTime" | "Rolling" | string

type Board = () → Board

Creates a new board within the Leaderboard.

Get

This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. Yields
Board:Get(
amountnumber,
sortDirectionstring?
) → Promise.TypedPromise<{TopData}>

Types

interface TopData {
Ranknumber
UserIdnumber
Valuenumber
Usernamestring
DisplayNamestring
}

Gets the top data for a specific board.

Update

This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. Yields
Board:Update(
userIdnumber,
valuenumber | (number) → (number)
) → boolean

Updates the data for a specific board (either MemoryStore (Shards), or OrderedDataStore).

Destroy

Board:Destroy() → ()

Destroys the board.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new board within the Leaderboard.",
            "params": [
                {
                    "name": "boardKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "leaderboardType",
                    "desc": "",
                    "lua_type": "LeaderboardType"
                },
                {
                    "name": "rollingExpiry",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "debugMode",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Board"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 171,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "Get",
            "desc": "Gets the top data for a specific board.",
            "params": [
                {
                    "name": "amount",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "sortDirection",
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise.TypedPromise<{TopData}>"
                }
            ],
            "function_type": "method",
            "yields": true,
            "source": {
                "line": 206,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "Update",
            "desc": "Updates the data for a specific board (either MemoryStore (Shards), or OrderedDataStore).",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "number | (number) -> (number)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "yields": true,
            "source": {
                "line": 266,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Destroys the board.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 319,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "LeaderboardType",
            "desc": "",
            "lua_type": "\"Hourly\" | \"Daily\" | \"Weekly\" | \"Monthly\" | \"Yearly\" | \"AllTime\" | \"Rolling\" | string",
            "source": {
                "line": 31,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "Board",
            "desc": "",
            "lua_type": "() -> Board",
            "source": {
                "line": 37,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "BoardArguments",
            "desc": "",
            "fields": [
                {
                    "name": "_boardKey",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "_storeUsing",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "_store",
                    "lua_type": "(MemoryStoreSortedMap | OrderedDataStore | MemoryShard)?",
                    "desc": ""
                },
                {
                    "name": "_threads",
                    "lua_type": "{thread}",
                    "desc": ""
                }
            ],
            "source": {
                "line": 47,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "TopData",
            "desc": "",
            "fields": [
                {
                    "name": "Rank",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "UserId",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Value",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Username",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "DisplayName",
                    "lua_type": "string",
                    "desc": ""
                }
            ],
            "source": {
                "line": 65,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        },
        {
            "name": "Object",
            "desc": "",
            "fields": [
                {
                    "name": "__index",
                    "lua_type": "Object",
                    "desc": ""
                },
                {
                    "name": "Update",
                    "lua_type": "(self: Board, userId: number, value: number | (number) -> (number)) -> Promise.TypedPromise<boolean>",
                    "desc": ""
                },
                {
                    "name": "Get",
                    "lua_type": "(self: Board, amount: number, sortDirection: string) -> Promise.TypedPromise<{TopData}>",
                    "desc": ""
                },
                {
                    "name": "Destroy",
                    "lua_type": "(self: Board) -> ()",
                    "desc": ""
                },
                {
                    "name": "new",
                    "lua_type": "(boardKey: string, leaderboardType: LeaderboardType, rollingExpiry: number?, debugMode: boolean?) -> Board",
                    "desc": ""
                }
            ],
            "source": {
                "line": 84,
                "path": "lib/Leaderboard/Board/init.luau"
            }
        }
    ],
    "name": "Board",
    "desc": "This class is used to create a new leaderboard board.",
    "source": {
        "line": 97,
        "path": "lib/Leaderboard/Board/init.luau"
    }
}