Reference des fonctions
Godot 4 · GDScript · Friends
list_friends
Lists the player's accepted friends, newest friendship first, with optional name search.
Asynchronous (result via signal)
Signature
list_friends(limit: int = 100, search: String = "") -> voidWhat it does
POSTs /friends/list. Returns only ACCEPTED friendships, newest first. Each entry: { player_key, player_name, friends_since } (friends_since is the ISO timestamp the friendship was created). Empty array on failure or when the player has no friends.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| limit | int | 100 | Maximum friends to return (clamped server-side to 1..200). |
| search | String | "" | Optional case-insensitive substring match on player_name (capped at 50 chars). |
How to call it
Connect friends_loaded first, then call list_friends(). Emits an empty array when there is no active session.
Result signal: friends_loaded(friends: Array)
Example
Gamdato.friends_loaded.connect(_on_friends)
Gamdato.list_friends() # or list_friends(50, "text")
func _on_friends(friends: Array) -> void:
for f in friends:
print("%s (since %s)" % [f.player_name, f.friends_since])Use cases
- Render the player's friends list in a social menu.
- Search a long friends list by typing part of a name.