GetFriendsOnline
This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
For thread safety, this property is not safe to read in an unsynchronized thread.
This function returns a dictionary array of online friends, limited by the maxFriends value.
In the returned array, some fields are only present for certain location types. For example, PlaceId won’t be present when LocationType is 0 (Mobile Website).
| Name | Type | Description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| VisitorId | number | The Player/UserId of the friend. |
||||||||||||||
| UserName | string | The username of the friend. | ||||||||||||||
| DisplayName | string | The display name of the friend. | ||||||||||||||
| LastOnline | string | When the friend was last online. | ||||||||||||||
| IsOnline | boolean | If the friend is currently online. | ||||||||||||||
| LastLocation | string | The name of the friend's current location. | ||||||||||||||
| PlaceId | number | The place ID of the friend's last location. | ||||||||||||||
| GameId | string | The DataModel/JobId of the friend's last location. |
||||||||||||||
| LocationType | number |
The location type of the friend's last location:
|
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
200
|
The maximum number of online friends to return. The default is 200. |
Returns
| Return Type | Summary |
|---|---|
|
A dictionary of online friends (see the table above). |
Code Samples
Get a List of Online Friends
This example demonstrates how to get a dictionary of a player’s online friends. It returns the maximum number of friends specified by the argument, or 200 if an argument is not provided.