API:GetChatChannelNames
From RoR Wiki
UI Lua API · Chat functions
Version: WAR 1.4.8
Returns the numbered chat channels the player is in.
channels = GetChatChannelNames()
Arguments
None.
Returns
- channels
table– Channel tables keyed by chat log filter id (channel number + 56), so thatchannels[SystemData.ChatLogFilters.CHANNEL_1]is channel 1. Channels the player is not in have no entry.
Each channel table has these fields:
| Key | Type | Meaning |
|---|---|---|
name |
wstring |
Channel name. |
number |
number |
Channel number. |
Details
- This is not a 1-based array; use
pairsor index it with theSystemData.ChatLogFilters.CHANNEL_nvalues. - The list is the client's copy; the function does not contact the server.
Errors
None.
Example
From default/ea_chatwindow/source/chatsettings.lua:
local channels = GetChatChannelNames()
...
for channelIndex, _ in pairs( ChatSettings.ChannelSwitches )
do
-- If there's a name entry, use that instead of the default
if( channels[channelIndex] ~= nil )
then
ChatSettings.Channels[channelIndex].labelText =
GetFormatStringFromTable( "ChatStrings", StringTables.Chat.CHAT_CHANNEL_REPLACE_CHANNEL_X, { channels[channelIndex].number, channels[channelIndex].name } )
...
