Skip to Content
defold-typescript libraries
widgrensitasobi-defold

widgrensit/asobi-defold/asobi.api.leaderboards

asobi leaderboards over REST. A project reaches it as client.leaderboards.

  • GitHub: widgrensit/asobi-defold — pinned to v1.18.1
    1. Pick a release from widgrensit/asobi-defold releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as api_leaderboards from "asobi.api.leaderboards"

Functions

get_top(client: Client, leaderboard_id: string, limit?: number, callback?: HttpCallback)

Fetches a leaderboard's top entries.

Parameters

  • client: Client — The client.
  • leaderboard_id: string — The leaderboard's id.
  • limit?: number — The most entries to return. Defaults to 100.
  • callback?: HttpCallback — Receives the entries, or the error.

get_around_player(client: Client, leaderboard_id: string, player_id: string, range_size?: number, callback?: HttpCallback)

Fetches the entries around a player's rank.

Parameters

  • client: Client — The client.
  • leaderboard_id: string — The leaderboard's id.
  • player_id: string — The player's id.
  • range_size?: number — How many entries on each side. Defaults to 5.
  • callback?: HttpCallback — Receives the entries, or the error.

get_around_self(client: Client, leaderboard_id: string, range_size?: number, callback?: HttpCallback)

Fetches the entries around the signed-in player's rank. The client must be signed in: it raises an error while client.player_id is unset.

Parameters

  • client: Client — The client.
  • leaderboard_id: string — The leaderboard's id.
  • range_size?: number — How many entries on each side. Defaults to 5.
  • callback?: HttpCallback — Receives the entries, or the error.

submit_score(client: Client, leaderboard_id: string, score: number, sub_score?: number, callback?: HttpCallback)

Submits the signed-in player's score.

Parameters

  • client: Client — The client.
  • leaderboard_id: string — The leaderboard's id.
  • score: number — The score.
  • sub_score?: number — The tie-breaking score. Defaults to 0.
  • callback?: HttpCallback — Receives the entry, or the error.

On this page