SteamGameServerLobby - stingray.SteamGameServerLobby object reference - Stingray Lua API Reference

stingray.SteamGameServerLobby object reference

Description

Represents a lobby for a game server.

A lobby can be created by joining a game server using Network.join_steam_server(). You can poll the lobby state to see if the connection was successful. Upon being connected, you will have successfully allocated a server slot and is guaranteed to be able to play.

Functions

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns
This function does not return any values.

After this has been called, the [get_data()] function after a short delay will begin to return the server data set on the server.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

key :

string

A string key that describes the value.

Returns

string?

The string stored for the key. If the lobby is not joined with a query port, this function will return nothing.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

Server data is always stored as strings.

NOTE: there is a slight delay between joining the lobby until the server data is transmitted, so for a short while, you cannot get any data.

To ensure that you get the correct, most up-to-date data from the server, you must call auto_update_data() once in order to make the data update itself automatically, or call request_data() prior to data().

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

An element from the State constants that indicates the reason for connection failure.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

string

The game description, or an empty string if the lobby is not yet connected.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

The Steam ID of the server.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

string[]

A table that lists the peer IDs for all members of the lobby.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.

Note that there is a slight delay after a peer joins before the lobby is notified. The list may therefore be incomplete, and should only be used to display members and things that are not vital.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns
This function does not return any values.

After this has been called, the [get_data()] function after a short delay will begin to return the server data set on the server.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

string

The name of the game server, or an empty string if the lobby is not yet connected.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

An element from the State constants that indicates the current state of the lobby.

Parameters

self :

stingray.SteamGameServerLobby

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

string

The server version as a string, or an empty string if the lobby is not yet connected.

State constants

The constants in this section may be returned by SteamGameServerLobby.state() and SteamGameServerLobby.fail_reason() in order to describe the current state or the connection failure of the lobby.

The lobby may be rejected due to server being full or other various reason.

A server slot is allocated now and the lobby should be able to play.

JOINING : integer

This state means the lobby is still trying to connect to the server to allocate a slot.

SERVER_IS_FULL : integer

This state indicates that the server is full.

TIMEOUT : integer

This state indicates that the server did not respond in time.