Reference des fonctions
Godot 4 · GDScript · Leaderboards & scores
search_players
Searches players by name within a table; results arrive via players_search_completed.
Asynchronous (result via signal)
Signature
search_players(table_index: int, query: String) -> voidWhat it does
POSTs the search to /leaderboards/scores and emits players_search_completed with the matches. Each result is a Dictionary with rank, player_key, player_name, and score. Does nothing if there's no active session or the index is invalid.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| table_index | int | required | Table number to search within (1-based: 1, 2, 3…). |
| query | String | required | Name (or substring) to look for. An empty/whitespace query is a no-op and emits no signal. |
How to call it
Connect players_search_completed first, then call this from a search box. Pair player_key with load_player_info() to open a full profile.
Result signal: players_search_completed(results: Array)
Example
Gamdato.players_search_completed.connect(_on_results)
Gamdato.search_players(1, "corvus")
func _on_results(results: Array) -> void:
for r in results:
print("#%d %s %d" % [r.rank, r.player_name, r.score])Use cases
- Let players find a friend by name in the leaderboard.
- Power a 'find player' search field with live results.