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

stingray.PsnRoom object reference

Description

Represents a room in a PlayStation Network (PSN) game.

You can create a new room by calling Network.create_psn_room(), or join an existing one by calling Network.join_psn_room().

Functions

Parameters

room :

stingray.PsnRoom

The PSN room whose host you want to set.

Returns

string?

The peer ID of the host of the game session for the room, 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.

Parameters

room :

stingray.PsnRoom

The PSN room whose member you want to retrieve.

index :

integer

The index of the member you want to retrieve.

Returns

network_psn_room_member

A table that contains information about the member.

Parameters

room :

stingray.PsnRoom

The PSN room whose members you want to retrieve.

Returns

integer

The number of members in the room.

Parameters

room :

stingray.PsnRoom

The PSN room whose owner you want to retrieve.

Returns

string

The peer ID of the room's owner.

Parameters

room :

stingray.PsnRoom

The PSN room whose data you want to set.

value :

string

A string value to store for the room, maximum 255 bytes.

Returns
This function does not return any values.

Other peers will be able to access this value in the data table returned by PsnRoomBrowser.room(). You can use this mechanism to store descriptive information about the room, 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 room.

The data this string represents and the format of the string are entirely up to you to decide.

Parameters

room :

stingray.PsnRoom

The PSN room whose host you want to set.

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.
Returns
This function does not return any values.

This is used by the room host in order to indicate to all connected peers that the game session has started.

Parameters

room :

stingray.PsnRoom

The PSN room whose name you want to set.

name :

string

The name for this room, as it should be visible to other peers that may want to join.

Returns
This function does not return any values.

Other peers will be able to access this value in the data table returned by PsnRoomBrowser.room(). 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.

Parameters

room :

stingray.PsnRoom

The PSN room whose state you want to retrieve.

Returns

integer

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

State constants

The constants in this section may be returned by PsnRoom.state() in order to describe the current state of the room.

If the room is successfully created, the state changes to PsnRoom.JOINED. If the creation fails, the state changes to PsnRoom.FAILED.

This state means the room is waiting for the room owner to accept this peer as a room member. When this peer is accepted, the state changes to PsnRoom.JOINED. If this peer is not accepted, the state changes to PsnRoom.FAILED.

This is the state of the room after it has been created with Network.create_psn_room(). When PsnClient.ready() returns true, the state changes to PsnRoom.CREATING.