chatroommanager - TogetherGames/Public-Corona-Lua GitHub Wiki

ChatRoomManager

together.ChatRoomManager

Overview

The ChatRoomManager is used for fetching and finding chatrooms that exist for the current game.


Members

table ChatRooms

Stores all the ChatRooms contained in the Manager.


Methods


Add()

Adds a ChatRoom to the manager internally without persistence.

Note
This method is deprecated

Returns void
Syntax
ChatRoomManager:Add( chatRoom )
Parameters

TogetherChatRoom chatRoom

Instance of a ChatRoom to add internally

--------------------------------------------------------------------------------

FindByChatRoomID()

Finds the ChatRoom with the specified ChatRoomID if it exists, otherwise returns nil.

Syntax
ChatRoomManager:FindByChatRoomID( chatRoomID )
Parameters

number chatRoomID

The ID of the ChatRoom to find

--------------------------------------------------------------------------------

GetCount()

Gets the number of ChatRooms currently managed by the internal list

Returns number
Syntax
ChatRoomManager:GetCount(  )

Get()

Gets the ChatRoom at the specified index if it exists, otherwise returns nil.

Syntax
ChatRoomManager:Get( index )
Parameters

number index

The index of the ChatRoom to retrieve

--------------------------------------------------------------------------------

IndexOf()

Returns the index of the specified ChatRoom if it exists, otherwise returns nil.

Returns number
Syntax
ChatRoomManager:IndexOf( chatRoom )
Parameters

TogetherChatRoom chatRoom

Instance of the ChatRoom to retrieve the index of

--------------------------------------------------------------------------------

IndexOfByChatRoomID()

Returns the index of the ChatRoom with the specified ChatRoomID if it exists, otherwise returns -1.

Returns number
Syntax
ChatRoomManager:IndexOfByChatRoomID( chatRoomID )
Parameters

number chatRoomID

The ID of the ChatRoom to find the index of

--------------------------------------------------------------------------------

Remove()

Removes a ChatRoom from the managed list without persistence.

Note
This method is deprecated

Returns void
Syntax
ChatRoomManager:Remove( index )
Parameters

number index

The index of the ChatRoom to be removed if it exists

--------------------------------------------------------------------------------

Create()

Creates a ChatRoom that can be associated to a Game Instance and optionally joined immediately.

Returns void
Syntax
ChatRoomManager:Create( name, description, roomID, gameInstanceID, chatRoomProperties, callbackFunc )
Parameters

string name

The name of the new ChatRoom.

[string](#) description

The description for the new ChatRoom.

[number](#) roomID

The ID of the room the ChatRoom is in. Pass in 0 for no room.

[number](#) gameInstanceID

The ID of the GameInstance the ChatRoom is associated with. GameInstances associated with ChatRooms will retrieved when GameInstanceManager:GetAll() is called.

[PropertyCollection](./propertycollection) chatRoomProperties

The properties to associate with the ChatRoom. Pass in null if no properties should be associated.

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Delete()

Deletes a ChatRoom with the specified ID.

Returns void
Syntax
ChatRoomManager:Delete( chatRoomID, callbackFunc )
Parameters

number chatRoomID

The ID of the ChatRoom to delete

[function](#) callbackFunc

The function to call upon completion

--------------------------------------------------------------------------------

GetAll()

Gets all ChatRooms or optionally all a specific user is a member of.

Returns void
Syntax
ChatRoomManager:GetAll( getForUserID, callbackFunc )
Parameters

number getForUserID

The ID of the User to get ChatRooms for. When specified, only the ChatRooms the User is a member of will be retrieved. Pass in 0 to retrieve all ChatRooms.

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------
⚠️ **GitHub.com Fallback** ⚠️