A "user" represents the concept of someone who is connected to the room. These are similar to players; each user has an associated player, but a player does not necessarily have a user. They are especially useful if you want to do something for everyone who is connected, but don't want to fuss around with the actual player objects.
There are the following static methods related to users:
Function | Returns | Description |
---|---|---|
onlinePlay.getUsers​() |
table | Returns all currently connected users. |
onlinePlay.getUserByPlayer​(​playerIdx (number)​) |
User or nil | Returns the user associated with the given player index if it exists. |
onlinePlay.getUserCount​() |
number | Returns the amount of users that are currently connected to the room. |
A user has the following instance methods:
Function | Returns | Description |
---|---|---|
:disconnect​() |
nil | Kicks the given user. Can only be run as a host, and you cannot kick yourself. |
A user has the following fields:
Field | Type | Description |
---|---|---|
.playerIdx |
number | The index of the player associated with the user. |
.lastResponseTime |
number | The local time that the user last responded at. See the timing page more. |
.pingedTime |
number | The local time that the user was last pinged at. See the timing page more. |
.pingCounter |
number | The number of the times that the user has been pinged. |
.pingValue |
number | The time, in seconds, that it took that the user to respond to the most recent ping. This is displayed in the top right when the chat is open. |
.isHost |
boolean | True if this user is the host. |
.isUnresponsive |
boolean | True if it has been several seconds since the user last responded. |