Represents a lobby in a LAN game.
You can create a new lobby by calling Network.create_lan_lobby(), or join an existing one by calling Network.join_lan_lobby().
Constructors and accessors
Other related reference items
data ( self, key ) : stringRetrieves a particular data value previously stored for the lobby by a call to set_data().
|
self : | 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. |
string |
The string stored for the key. |
Other related reference items
game_session_host ( self ) : string?Returns the game session host for the lobby.
|
self : | 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. |
string? |
The peer ID of the host of the game session for the lobby, or nil if no game session host has been set. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
If a peer detects that a game session host has been set, it should typically first load the level map and then send a message to the game session host saying that it wants to drop into the session. Upon receiving that message, the game session host should call GameSession.add_peer() to add the peer to the game session.
kick ( self, peer )Removes the specified peer from the lobby.
|
self : | 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. | |
peer : | any(string, integer) | The string ID of the peer, or the zero-based index value of the peer within the list of peers in the lobby. The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
This function does not return any values. |
Only the lobby host can call this function.
lobby_host ( self ) : stringReturns the ID of the peer that is acting as the host for the lobby.
|
self : | 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. |
string |
The ID of the peer hosting the lobby. |
members ( self ) : string[]Retrieves a list of all peers currently connected to the lobby.
|
self : | 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. |
string[] |
A list of the peer IDs of all peers connected to 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. |
member_data ( self, peer_id, key ) : stringRetrieves the specified data stored for the specified peer in the lobby.
|
self : | 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. | |
peer_id : | string | The peer ID of the lobby member whose data you want to retrieve. |
key : | string | The string key that describes the value you want to retrieve. |
string |
The string value stored for the specified key. |
Other related reference items
own_data ( self, key ) : stringRetrieves the specified data stored for the peer calling this function.
|
self : | 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 | The string key that describes the value you want to retrieve. |
string |
The string value stored for the specified key. |
set_data ( self, key, value )Stores a particular data value for the lobby.
|
self : | 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. |
value : | string | A string value to store for the key. |
This function does not return any values. |
Other peers will be able to access this value in the data table returned by LanLobbyBrowser.lobby(). You can use this mechanism to store descriptive information about the lobby, such as the name of the host, the name of the game, the name of the level or map that will be played, etc. Your game can then present this information to other prospective players, in order for those players to decide whether or not to join the lobby.
Any peer that has joined the lobby can access the value by calling data().
Other related reference items
set_game_session_host ( self, peer_id )Sets the host of the game session to the specified peer.
|
self : | 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. | |
peer_id : | string? | The ID of the peer that should become the host of the game session, or nil to clear the game session host. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
This is used by the lobby host in order to indicate to all connected peers that the game session has started.
set_member_data ( self, key, value )Stores a particular data value for the member of the lobby calling this function.
|
self : | 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. |
value : | string | A string value to store for the key. |
This function does not return any values. |
Other members of the lobby can access this data by calling member_data().
state ( self ) : integerIndicates the current state of the lobby, and whether or not this peer has joined successfully.
|
self : | 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. |
integer |
An element from the State constants that indicates the current state of the lobby. |
Other related reference items
The constants in this section may be returned by LanLobby.state() in order to describe the current state of the lobby.
CREATING : integerThis is the state of the lobby after it has been created with Network.create_lan_lobby().
|
If the lobby is successfully created, the state will change to LanLobby.JOINED. If the creation fails, the state will be LanLobby.FAILED.
FAILED : integerThis state indicates that this peer has been rejected by the lobby host, or has dropped out of the lobby due to a problem such as a bad connection.
|
Other related reference items
JOINED : integerThis state indicates that this peer has been accepted into the lobby.
|
Other related reference items
JOINING : integerThis state means the lobby is waiting for the lobby host to accept this peer as a lobby member.
|
When this peer has been accepted, the state changes to LanLobby.JOINED. If this peer is not accepted, the state changes to LanLobby.FAILED.