Referencia de funciones
Godot 4 · GDScript · Setup & session
set_leaderboard
Declares the leaderboard tables this game uses; array order defines each table's number (1-based).
Synchronous (returns directly)
Signature
set_leaderboard(table_keys: Array) -> voidWhat it does
Stores the table keys and (re)sizes the local cache for them. Once the session is active the plugin loads each table once and emits tables_loaded when they are all in.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| table_keys | Array | required | Table keys from the panel. The array order defines each table's number, 1-based (1, 2, 3…), that you pass to every other leaderboard call. |
How to call it
Call once, right after set_controller().
Returns: void
Example
Gamdato.set_leaderboard(["main_normal", "main_chaotic"])
# "main_normal" is table 1, "main_chaotic" is table 2Use cases
- Register the one or many leaderboards your game submits scores to.
- Map readable table numbers (1, 2, 3) to panel table keys so the rest of your code never repeats the key strings.