Friends - stingray.Friends namespace reference - Stingray Lua API Reference

Description

This interface handles friends on Steam.

Friend information

Parameters

id :

string

The Steam ID of the player.

category :

integer

A value from the friend relations group.

Returns

boolean

True if the specified player is in the category, or false otherwise.

Parameters

id :

string

A Steam ID.

Returns

string

The name of the friend.

Parameters

id :

string

The Steam ID of the player.

Returns

steam_friend_game_info?

Returns a table that describes the game the player is currently playing, or nil if the friend is not playing a game.

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

id :

string

The Steam ID of the player.

Returns

integer

A value from the friend relations group.

Parameters

id :

string

The Steam ID of the player.

Returns

integer

A value from the friend status group.

Friend invite types

Friend relations

BLOCKED : integer

Blocked friend.

FRIEND : integer

Friend.

IGNORED : integer

Ignored player.

IGNORED_FRIEND : integer

Ignored friend.

NONE : integer

Non-friend.
Player requesting friendship.
Friend requested.

SUGGESTED : integer

Suggested friend.

Friend relation flags

BLOCKED_FLAG = 1 : integer

Blocked friends.

CLAN_MEMBER_FLAG = 8 : integer

Clan members.
Friends requested.

IGNORED_FLAG = 256 : integer

Ignored players.

IGNORED_FRIEND_FLAG = 512 : integer

Ignored friends.

ON_GAME_SERVER_FLAG = 16 : integer

Players on a game server.
Players requesting friendship.

REQUESTING_INFO_FLAG = 128 : integer

Requesting info.

SUGGESTED_FLAG = 1024 : integer

Suggested friends.

Friend status

AWAY : integer

Away.

BUSY : integer

Busy.

LOOKING_TO_PLAY : integer

Looking to play.

OFFLINE : integer

Offline.

ONLINE : integer

Online.

SNOOZE : integer

Snoozing.

TRADING : integer

Trading.

Invites

Parameters
This function does not accept any parameters.
Returns

integer

The invitation type. Will match one of the invite type constants. If this is NO_INVITE, you have not received an invitation.

string

The address of the game to connect to.

  • If the invitation type is INVITE_LOBBY, this value will be the lobby ID of the lobby to join.
  • If the invitation type is INVITE_SERVER, this value will be the game server address in the form "a.b.c.d:port", where the port is the connection port.

If so, your game must immediately join the specified server or lobby.

Parameters

id :

string

The Steam ID of the player.

game :

any(stingray.SteamLobby, string)

The game the player should connect to. May be either a SteamLobby object, a lobby ID, or an IPv4 game server address in the form "a.b.c.d:port", where the port is the connection port.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

extra_params :

string?

Optional. A string parameter that adds extra information to the invite. Steam uses this as parameters on the command line, so do not use spaces or quotations in the string. This can be 31 characters wide. Keep it simple.

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

password :

string?

Optional. Password string is only for game server invites.

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.
Parameters
This function does not accept any parameters.
Returns

integer

The invitation type. Will match one of the invite type constants. If this is NO_INVITE, you have not received an invitation.

string

The address of the game to connect to.

  • If the invitation type is INVITE_LOBBY, this value will be the lobby ID of the lobby to join.
  • If the invitation type is INVITE_SERVER, this value will be the game server address in the form "a.b.c.d:port", where the port is the connection port.

string

A string with any extra parameters specified in the invite.

string

The invitee: the ID of the friend who made the invite.

If so, your game should ask the player if he or she wants to join the specified server or lobby. For this to work, the invitee must also have called Presence.advertise_playing() to indicate the lobby or server to invite to. Otherwise, invites from the Steam client do not work properly.

Listing friends

Parameters

index :

integer

A one-based index in the list fetched by the last call to Friends.num_friends().

Returns

string

The Steam ID of the friend at the specified index.

Parameters

category_mask :

integer?

Optional. A value that represents one or more categories. Add together any number of the constants in the friend relation flags group to form a mask. If no mask is specified, FRIEND_FLAG is used.

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

integer

Returns the number of friends in the categories.

After calling this function, you can call id() to fetch the IDs of friends in the specified categories.