GameMaker Studio · GML · Leaderboards & scores
gmda_getTabledata
Returns the cached top entries for a table as a ds_grid (6 columns x 10 rows).
Signature
gmda_getTabledata(table) -> ds_gridWhat it does
Returns the cached global top entries for that table (loaded on the tables_loaded event and refreshed after a successful submit) as a ds_grid. No network call, so the ranking renders instantly and works offline. Read cells with ds_grid_get(grid, col, row).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| table | real | required | Table number to read. 1-based: the first declared table is 1, the second is 2, and so on. |
How to call it
Call any time after the tables_loaded event to draw the leaderboard. Iterate rows until player_name (column 1) comes back empty. For periodic or friends-only views, use gmda_loadLeaderboardView() instead.
Returns: ds_grid (6 columns x 10 rows): column 0 rank, 1 player_name, 2 score, 3-5 custom_data[0..2]. Rows fill top-down; the first row with an empty player_name marks the end of the data.
Example
var grid = gmda_getTabledata(1);
for (var row = 0; row < 10; row++) {
var name = ds_grid_get(grid, 1, row);
if (name == "") break; // empty name marks the end
var rank = ds_grid_get(grid, 0, row);
var score = ds_grid_get(grid, 2, row);
show_debug_message("#" + string(rank) + " " + name + " " + string(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.