megalanthusdefold-gamepush
megalanthus/defold-gamepush/gamepush.core.leaderboard
GamePush leaderboards: the leaderboard overlay, fetching leaders and ratings, and scoped records.
- GitHub: megalanthus/defold-gamepush — pinned to
v1.4.1- Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as core_leaderboard from "gamepush.core.leaderboard"
- Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged
Functions
open(parameters?: Record<string, unknown>)fetch(parameters?: Record<string, unknown>, callback?: (leaders: unknown) => void)fetch_player_rating(parameters?: Record<string, unknown>, callback?: (leaders: unknown) => void)open_scoped(parameters: Record<string, unknown>, callback?: (result: unknown) => void)fetch_scoped(parameters: Record<string, unknown>, callback?: (leaders: unknown) => void)publish_record(parameters: Record<string, unknown>, callback?: (result: unknown) => void)fetch_player_rating_scoped(parameters: Record<string, unknown>, callback?: (leaders: unknown) => void)
open(parameters?: Record<string, unknown>)
Shows the leaderboard in the in-game overlay.
Parameters
parameters?:Record<string, unknown>— The display options, for example{ limit: 5, order: "DESC", withMe: "last" }, or nil for the defaults.
fetch(parameters?: Record<string, unknown>, callback?: (leaders: unknown) => void)
Fetches the leaderboard.
Parameters
parameters?:Record<string, unknown>— The display options, or nil for the defaults.callback?:(leaders: unknown) => void— Receives the leaders.
fetch_player_rating(parameters?: Record<string, unknown>, callback?: (leaders: unknown) => void)
Fetches the player's rating.
Parameters
parameters?:Record<string, unknown>— The display options, for example{ includeFields: ["level"] }, or nil for the defaults.callback?:(leaders: unknown) => void— Receives the rating.
open_scoped(parameters: Record<string, unknown>, callback?: (result: unknown) => void)
Shows a scoped leaderboard in the in-game overlay. Raises when the table is missing.
Parameters
parameters:Record<string, unknown>— The leaderboard, for example{ tag: "test", variant: "levels" }.callback?:(result: unknown) => void— Receives the result.
fetch_scoped(parameters: Record<string, unknown>, callback?: (leaders: unknown) => void)
Fetches a scoped leaderboard. Raises when the table is missing.
Parameters
parameters:Record<string, unknown>— The leaderboard, for example{ tag: "test", variant: "levels" }.callback?:(leaders: unknown) => void— Receives the leaders.
publish_record(parameters: Record<string, unknown>, callback?: (result: unknown) => void)
Publishes the player's record to a scoped leaderboard. Raises when the table is missing.
Parameters
parameters:Record<string, unknown>— The leaderboard and the record, for example{ tag: "test", variant: "levels", record: { level: 50 } }.callback?:(result: unknown) => void— Receives the result.
fetch_player_rating_scoped(parameters: Record<string, unknown>, callback?: (leaders: unknown) => void)
Fetches the player's rating in a scoped leaderboard. Raises when the table is missing.
Parameters
parameters:Record<string, unknown>— The leaderboard, for example{ tag: "test", variant: "levels" }.callback?:(leaders: unknown) => void— Receives the rating.