Referencia de funciones
Godot 4 · GDScript · Leaderboards & scores
get_view_cached
Returns the cached entries for a leaderboard view (period + optional friends-only).
Synchronous (returns directly)
Signature
get_view_cached(table_index: int, period: String = "all", friends_only: bool = false) -> ArrayWhat it does
Reads the locally cached results for a previously loaded view (both the plain and friends-only variants persist to disk). Search-filtered queries are never cached. No network call.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| table_index | int | required | Table number to read (1-based: 1, 2, 3…). |
| period | String | "all" | View period: "all", "daily", "weekly", or "monthly". |
| friends_only | bool | false | True to read the friends-only variant of the view. |
How to call it
Call to populate a view instantly from cache before (or instead of) load_leaderboard_view() triggers a fresh fetch.
Returns: Array: the cached rows for that view, or an empty Array if the index is invalid or nothing is cached.
Example
var weekly := Gamdato.get_view_cached(1, "weekly")
for row in weekly:
print("#%d %s %d" % [row.rank, row.player_name, row.score])Use cases
- Fill a 'weekly' or 'friends' tab from cache so it never opens empty.
- Show last-known view data while offline.