WoW:API GetChannelName: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
Line 1: Line 1:
<center>'''GetChannelName''' ''-Documentation by wowpendium.de-''</center>


== GetChannelName("channel" or index) ==
Retrieves the id and the name from a specific channel.
 
id, name = GetChannelName(id);
 
----
;''Arguments''
:(Number id or String id)
 
:;id : The id of the channel you want to query, either as a number (1) or as a string ("1").
 
----
;''Returns''
 
:;id : a number containing the id of the channel, e.g. 2, or 0 if the channel is not found
:;name : a string containing the name of the channel, e.g. "Trade - Stormwind", or nil if the channel is not found
 
----
;''Example''
-- Check if the specific channel exists
myChannel = 1;
id, name = GetChannelName(myChannel);
if (not id == 0 and name ~= nil) then
  SendChatMessage("This is just a test.", "CHANNEL", nil, myChannel);
end
 
;''Result''
 
Checks if the channel with id stored in myChannel exists and in this case sends the text "This is just a test" to it.
 
----
;''Description''
 
: Retrieves the name from a specific channel.
 
----
{{Template:WoW API}}

Revision as of 10:20, 5 March 2005

GetChannelName -Documentation by wowpendium.de-

Retrieves the id and the name from a specific channel.

id, name = GetChannelName(id);

Arguments
(Number id or String id)
id
The id of the channel you want to query, either as a number (1) or as a string ("1").

Returns
id
a number containing the id of the channel, e.g. 2, or 0 if the channel is not found
name
a string containing the name of the channel, e.g. "Trade - Stormwind", or nil if the channel is not found

Example
-- Check if the specific channel exists
myChannel = 1;
id, name = GetChannelName(myChannel);
if (not id == 0 and name ~= nil) then
  SendChatMessage("This is just a test.", "CHANNEL", nil, myChannel);
end
Result

Checks if the channel with id stored in myChannel exists and in this case sends the text "This is just a test" to it.


Description
Retrieves the name from a specific channel.

Template:WoW API