WoW:API GetTrainerServiceIcon: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API GetTrainerServiceIcon to WoW:API GetTrainerServiceIcon without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{API/Uncategorized}}
{{wowapi}}
Returns the icon texture for a particular trainer service.
 
icon = GetTrainerServiceIcon(id);
 
----
;''Arguments''
 
:; id : Index of the trainer service to retrieve information about. Note that indices are affected by the trainer filter. (See [[API_GetTrainerServiceTypeFilter|GetTrainerServiceTypeFilter]] and [[API_SetTrainerServiceTypeFilter|SetTrainerServiceTypeFilter]].)
 
----
;''Returns''
 
:; icon : (String) Name of the icon texture for a particular trainer service. nil if id is a header rather than a spell line.
 
----
;''Example''
 
Prints skill names and icon textures when interacting with a trainer.
local i, name, category, icon;
for i=1,GetNumTrainerServices() do
  name, _, category = GetTrainerServiceInfo(i);
  if (name == nil) then
  break; -- GetNumTrainerServices() does not check if you're talking to a trainer or not.
  end
  if (category ~= "header") then
  icon = GetTrainerServiceIcon(i);
  DEFAULT_CHAT_FRAME:AddMessage(name .. ": " .. icon);
  end
end

Latest revision as of 04:46, 15 August 2023

WoW API < GetTrainerServiceIcon

Returns the icon texture for a particular trainer service.

icon = GetTrainerServiceIcon(id);

Arguments
id
Index of the trainer service to retrieve information about. Note that indices are affected by the trainer filter. (See GetTrainerServiceTypeFilter and SetTrainerServiceTypeFilter.)

Returns
icon
(String) Name of the icon texture for a particular trainer service. nil if id is a header rather than a spell line.

Example

Prints skill names and icon textures when interacting with a trainer.

local i, name, category, icon;
for i=1,GetNumTrainerServices() do
 name, _, category = GetTrainerServiceInfo(i);
 if (name == nil) then
  break; -- GetNumTrainerServices() does not check if you're talking to a trainer or not.
 end
 if (category ~= "header") then
  icon = GetTrainerServiceIcon(i);
  DEFAULT_CHAT_FRAME:AddMessage(name .. ": " .. icon);
 end
end