Referencia de funciones
Godot 4 · GDScript · Leaderboards & scores
get_table_data
Returns the cached top entries for a table as an Array of Dictionaries.
Synchronous (returns directly)
Signature
get_table_data(table_index: int) -> ArrayWhat it does
Returns the cached global top entries for that table (loaded on tables_loaded and refreshed after a successful submit). No network call, so the ranking renders instantly and works offline.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| table_index | int | required | Table number to read (1-based: 1, 2, 3…). |
How to call it
Call any time after tables_loaded to draw the leaderboard. For periodic or friends-only views, use load_leaderboard_view() instead.
Returns: Array: cached top rows, each a Dictionary with keys rank, player_key, player_name, score, custom_data. Empty Array if the index is invalid or nothing is loaded.
Example
for row in Gamdato.get_table_data(1):
print("#%d %s %d" % [row.rank, row.player_name, row.score])Use cases
- Render the global leaderboard list on a results or ranking screen.
- Show the current top entries immediately, even before any new network fetch.