The following are not primitive Lua data types, but for the purposes of this Reference it is useful to recognize cases where API functions expect or return data in a standard format.
Type: 1nil
Many API functions return a value indicative of a binary state but do not use the boolean true and false values -- instead returning 1 for true and nil for false. Since Lua treats nil as false and any non-nil value as true in conditionals, these values can generally be used the same as boolean values (e.g. if IsInGuild() then ... end). However, one should avoid making direct comparisons: for example, the condition in if IsInGuild() == true then ... end will never be triggered.
Type: actionID
Index identifying one of the player's action bar slots.
In UI terms, action slots are a layer of abstraction between spells or items and the mechanisms available to the player for using them conveniently. For example, instead of the default UI internally using SetBindingSpell(), SetBindingMacro(), et al whenever the player changes the contents of the visible action bars, it instead manages a set of key bindings corresponding to the action bar slots.
Every player has at least NUM_ACTIONBAR_PAGES * NUM_ACTIONBAR_BUTTONS (in the current client, 6 * 12, or 72) action slots corresponding to the six default action bar pages. In addition, players of certain classes (or with certain talents) may have additional actionIDs available corresponding to the "bonus" action bars that automatically become available when changing stances, stealthing, shapeshifting, etc.
Type: ah-list-type
There are three different auction house listing types:
list- The items that are currently for sale in the auction house.bidder- The items for which the player has bid.owner- The items that the player has placed up for auction.
Type: anchorPoint
String identifying a point relative to the dimensions of a Region; used in frame layout. Possible values:
CENTERBOTTOMTOPLEFTRIGHTBOTTOMLEFTBOTTOMRIGHTTOPLEFTTOPRIGHT
Type: arenaTeamID
Identifies one of the (up to three) Arena teams to which a player can belong. These indices begin at 1 for the player's smallest team and increase with team size. For example, if the player belongs to a 2v2 team and a 5v5 team, 1 indicates the 2v2 team and 2 indicates the 5v5 team. But if the player belongs to a 3v3 team and a 5v5 team, 1 indicates 3v3 and 2 indicates 5v5. If the player is on teams of all three sizes, 1 indicates 2v2, 2 is 3v3, and 3 is 5v5.
The Blizzard UI's Lua function ArenaTeam_GetTeamSizeID can be used to translate a team size (2, 3, or 5) to the appropriate arenaTeamID for the player.
Type: auraFilter
This parameter can be any of "HELPFUL", "HARMFUL", "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE". You can also specify several filters separated by a | or space character to chain multiple filters together (e.g. "HELPFUL|RAID" or "HELPFUL RAID" == helpful buffs that you can cast on your raid). By default UnitAura has "HELPFUL" as an implicit filter - you cannot get back BOTH helpful and harmful at the same time. Neither "HELPFUL" or "HARMFUL" have meaning for UnitBuff/UnitDebuff, and will be ignored.
Type: backdrop
A backdrop definition is a Lua table with specific attributes, that match directly with the elements in the <Backdrop> definition in an XML definition. It has the following structure:
{
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
tileSize = 32
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = 1,
edgeSize = 32,
insets = {
top = 12,
right = 12,
left = 12,
bottom = 12,
}
}
Type: bitfield
A value combining several binary flags into one number; the flags can be inspected individually using bitlib functions. For example (using GetItemFamily and related constants):
GetItemFamily("Crystallized Air")
-- returns 1224
bit.bor(0x0008,0x0040,0x0080,0x0400)
-- returns 1224
-- these are the masks for Leatherworking, Enchanting, Engineering, and Mining bags
bit.band(GetItemFamily("Crystallized Air"), 0x0040)
-- returns 64, or 0x0040: the item fits in an Enchanting Bag
bit.band(GetItemFamily("Crystallized Air"), 0x0020)
-- returns 0, or 0x0040: the item does not fit in an Herb Bag
Type: chatMsgType
String identifying the common type of a set of chat window messages; used in chat window functions for determining which windows display which messages and the colors used for displaying each message type.
Each CHAT_MSG_X event has a corresponding chatMsgType, idendified by the part of the event name following the initial CHAT_MSG_; e.g. the chatMsgType for CHAT_MSG_COMBAT_FACTION_CHANGE is COMBAT_FACTION_CHANGE. A list of pre-configured chatMsgTypes can be found as keys in the global table ChatTypeInfo.
Type: colorString
Formatting used to colorize sections of text when displayed in a FontString. Color strings take the form |c(colorvalue)(text)|r:
(colorvalue)- A string of four hexadecimal-formatted bytes describing component values of the color. Each byte can be a value from00(representing zero intensity of the component) toff(representing full intensity of the component):- Nominally alpha value, but currently unused: always
ff. - Red component of the color
- Green component of the color
- Blue component of the color
- Nominally alpha value, but currently unused: always
(text)- The text to be colorized.
Examples: |cffffff00(bright yellow)|r, |cff0070dd(rare item blue)|r, |cff40c040(easy quest green)|r
Color strings can be used for display anywhere in the UI, can only be delivered in chat messages if used as part of a hyperlink.
Type: containerID
Identifies one of the player's bags or other containers. Possible values:
-2: Keyring-1Main storage area in the bank0: Backpack1throughNUM_BAG_SLOTS: Bag slots (as presented in the default UI, numbered right to left)NUM_BAG_SLOTS + 1throughNUM_BAG_SLOTS + NUM_BANKBAGSLOTS: Bank bag slots (as presented in the default UI, numbered left to right)
Type: containerSlotID
Index of an item slot within a container. Slots are numbered (as presented in the default UI) left-to-right, top-to-bottom, starting with the leftmost slot on the top row.
Type: glyphIndex
Glyph indices are ordered by the level at which they are discovered. Specifically:
- The major glyph at the top of the user interface (level 15)
- The minor glyph at the bottom of the user interface (level 15)
- The minor glyph at the top left of the user interface (level 30)
- The major glyph at the bottom right of the user interface (level 50)
- The minor glyph at the top right of the user interface (level 70)
- The major glyph at the bottom left of the user interface (level 80)
Type: GUID (Globally Unique IDentifier)
All entities in World of Warcraft are identified by a unique 64-bit number; generally presented as a string containing a hexadecimal representation of the number (e.g. "0xF530007EAC083004"). (Note that Lua in WoW does not support 64-bit integers, so this value cannot be converted with tonumber.)
The type of unit represented by a GUID can be determined by using bit.band() to mask the first three digits with 0x00F:
- 0x000 - A player
- 0x003 - An NPC
- 0x004 - A player's pet (i.e. hunter/warlock pets and similar; non-combat pets count as NPCs)
- 0x005 - A vehicle
Further content of the GUID varies by unit type:
Players - The remaining thirteen digits are unique to a player character at least within that character's battlegroup (that is, they remain unique and constant even in cross-server battlegrounds). This number is also semi-permanent -- it persists from character creation until deletion, renaming, or server transfer.
NPCs - Remaining digits can be broken down as follows:
- Digits 4-6 - Unused.
- Digits 7-10 - NPC creature ID: identifies the specific named NPC (e.g. Hogger, Loque'nahak) or type of NPC (e.g. Sunfury Nethermancer, Shattertusk Mammoth). Converting to decimal results in the ID found on database sites such as wowhead.com; can also be used with [[docs/widgets/PlayerModel/SetCreature|
PlayerModel:SetCreature]] to view the NPC's model. - Digits 11-16 - Spawn counter: identifies the individual NPC (i.e. differentiates between the Gamon you recently killed and the Gamon that respawned a few minutes later, or between one Ymirheim Defender and another).
Pets - Hunter pets immediately after taming retain the GUID they had as a wild creature; after resummoning or logout/login, their GUID changes to the pet format. Remaining digits can be broken down as follows:
- Digits 4-10 - A constant value unique to the individual pet: like a player's unique ID it is constant across multiple sessions.
- Digits 11-16 - Spawn counter: changes when the pet is dismissed and re-summoned.
Vehicles - Same format and content as NPCs.
For example, the GUID 0xF530007EAC083004 can be deconstructed as follows:
- digits 1-3 are "F53";
bit.band(0xF53, 0x00F) == 0x003, so this is an NPC - digits 7-10 are "7EAC";
0x7EAC == 32428, which we can look up to find the NPC is a Underbelly Rat. - digits 11-16 have no intrinsic meaning, but distinguish this Underbelly Rat from all others spawned since the last server reset.
Example Code: a function to decode GUIDs
function ParseGUID(guid)
local first3 = tonumber("0x"..strsub(guid, 3,5))
local unitType = bit.band(first3,0x00f)
if (unitType == 0x000) then
print("Player, ID #", strsub(guid,6))
elseif (unitType == 0x003) then
local creatureID = tonumber("0x"..strsub(guid,9,12))
local spawnCounter = tonumber("0x"..strsub(guid,13))
print("NPC, ID #",creatureID,"spawn #",spawnCounter)
elseif (unitType == 0x004) then
local petID = tonumber("0x"..strsub(guid,6,12))
local spawnCounter = tonumber("0x"..strsub(guid,13))
print("Pet, ID #",petID,"spawn #",spawnCounter)
elseif (unitType == 0x005) then
local creatureID = tonumber("0x"..strsub(guid,9,12))
local spawnCounter = tonumber("0x"..strsub(guid,13))
print("Vehicle, ID #",creatureID,"spawn #",spawnCounter)
end
end
Type: hyperlink
A string containing markup allowing the client to present it as a link, which the player can click to view more information about or take action regarding the data it represents.
Hyperlinks take the form |H(linktype):(linkdata)|h(text)|h, where (linktype) determines the type of link, (linkdata) is a code referencing the linked information, and (text) is the text visible to the player. Some API functions which operate on links do not require a full hyperlink, only its linktype:linkdata portion.
Links are often encapsulated in a colorString -- in such cases, the full colorString-wrapped link is the only form of the link allowed to be used in chat; attempting to transmit an invalid link may cause the player to be disconnected from the server.
The WoW client recognizes several kinds of hyperlinks, identified by their linktype. For linkdata elements noted as optional below, the client can still resolve the link if they are omitted:
player(example:|Hplayer:Aerdrig|h[Aerdrig]|h) - Represents a player character. Left-clicking a player link in the default UI opens the ChatFrameEditBox to send a whispered message to the character. Right-clicking opens a menu with options for inviting the character to the player's party/raid, adding the character to the ignore list, or reporting the chat message in which the link appears as spam. Thelinkdatafor a player link consists solely of the player's name (or in cross-realm battlegrounds, the player's name and home realm separated by a hyphen, e.g. "Gundark-Broxigar").playerGM(example:|HplayerGM:Eyonix|h[Eyonix]|h) - A variation on theplayertype used exclusively for Game Master chat.glyph(example:|cff66bbff|Hglyph:23:460|h[Glyph of Fortitude]|h|r) - Represents a glyph inscribed in a character's spellbook. Clicking a glyph link in the default UI shows a tooltip with its description. Thelinkdatafor a glyph link follows the formatsocket:glyphID:socket(optional) - The socket in which the glyph is placed; values 21 through 26 correspond to [[docs/api_types#glyphIndex|glyphIndex]] values 1 through 6.glyphID- A unique identifier for the glyph effect; not used elsewhere in the API.
spell(example:|cff71d5ff|Hspell:46584|h[Raise Dead]|h|r) - Represents a spell. Clicking a spell link in the default UI shows a tooltip with its description. Thelinkdatafor a spell link consists solely of thespellIDnumber uniquely identifying the spell, usable with APIs such asGetSpellInfo().enchant(example:|cffffd000|Henchant:59387|h[Certificate of Ownership]|h|r) - Represents a trade skill recipe (originally used only for Enchanting, but now applies to all trade skills). Clicking a spell link in the default UI shows a tooltip with its description (and that of the item it creates, if applicable). Thelinkdatafor a spell link consists solely of thespellIDnumber uniquely identifying the trade skill recipe, usable with APIs such asGetSpellInfo().quest(example:|cffffff00|Hquest:982:17|h[Deep Ocean, Vast Sea]|h|r) - Represents a quest from a character's quest log. Clicking a quest link in the default UI shows a tooltip with a brief description of the quest and its objectives. When the client displays a quest link sent by another character, it automatically alters the enclosingcolorStringto reflect the difficulty of the quest relative to the player's level. Thelinkdatafor a quest link follows the formatquestID:level:questID- A unique identifier for the quest; found on database sites (e.g. [[wowhead:quest=982|quest ID 982]]) but not used elsewhere in the API.level(optional) - Recommended character level for attempting the quest. (A level of-1means the quest is appropriate for any level; used for holiday quests.)
talent(example:|cff4e96f7|Htalent:1396:4|h[Unleashed Fury]|h|r) - Represents a talent. Clicking a talent link in the default UI shows a tooltip with its description. Thelinkdatafor a talent link follows the formattalentID:points:talentID- A unique identifier for the talent; not used elsewhere in the API.rank(optional) - Number of points spent in the talent, minus one: if this value is omitted or-1, the tooltip shows the talent as it appears in the Talents UI when zero points have been spent ; if this value is0, the tooltip shows the talent as it appears when one point has been spent on it. Values greater than the number of available ranks for a talent are interpreted as-1.
achievement(example:|cffffff00|Hachievement:2336:060000000279E425:1:10:14:8:4294967295:4294967295:4294967295:4294967295|h[Insane in the Membrane]|h|r) - Represents an achievement earned or in progress by a player. Clicking an achievement link in the default UI shows a tooltip with a summary of the achievement and (if applicable) its criteria. Thelinkdatafor an achievement link follows the formatachievementID:playerGUID:completed:month:day:year:bits1:bits2:bits3:bits4. If only the first elementacheivementIDis specified, the client resolving the link will show the player's progress or completion of the achievement; otherwise, all elements are required:achievementID- A unique identifier for the achievements; usable with various Achievement API functions.playerGUID(optional) - GUID of a player character whose progress or completion of the achievement is linked (return value of [[docs/api/UnitGUID|`UnitGUID']] without the "0x" prefix).completed(optional) -1if the character has completed the achievement; otherwise0.month(optional) - Index of the month (1 = January) in which the character completed the achievement, or0if the achievement is incomplete.day(optional) - Day of the month on which the character completed the achievement, or0if the achievement is incomplete.year(optional) - Year (two-digit year) in which the character completed the achievement, or-1if the achievement is incomplete.bits1,bits2,bits3,bits4(optional) - Encoded data fields interpreted by the client to show completion of achievement criteria.
trade(example:|cffffd000|Htrade:45361:339:375:60000000279E425:Q/nPf6nprU3/n/fA8/Bw/PA+/B+/Aw/HA+/Bw/HA+5nfg////////P////HAAAQAA+DAAAAAAA|h[Inscription]|h|r) - Represents the entire list of recipes for a character's trade skill or profession. Thelinkdatafor an achievement link follows the formatspellID:skill:maxSkill:playerGUID:data. If only the first elementacheivementIDis specified, the client resolving the link will show the player's progress or completion of the achievement; otherwise, all elements are required:spellID- The [[docs/api_types#spellID|spellID]] number uniquely identifying the trade skill and its rank (e.g. Apprentice Tailoring vs. Journeyman Tailoring), usable with APIs such as [[docs/api/GetSpellInfo|GetSpellInfo()]].skill- The character's current skill in the profession.maxSkill- The maximum skill for the character's current rank in the profession (e.g. 375 for Master rank).playerGUID- GUID of the character whose profession is linked (return value of [[docs/api/UnitGUID|`UnitGUID']] without the "0x" prefix).data(optional) - Encoded data field interpreted by the client to show the character's list of known trade skill recipes.
item(examples:|cffa335ee|Hitem:45457:3828:3395:3395:0:0:0:0:80|h[Staff of Endless Winter]|h|r,|cff1eff00|Hitem:36360:0:0:0:0:0:-37:1633878093:80|h[Frostpaw Legguards]|h|r) - Represents an item. Clicking an item link in the default UI shows a tooltip with information about the item. Control-clicking an equippable item opens the DressUpFrame to preview how the item would look on the player character if equipped. Thelinkdatafor an item link follows the formatitemID:enchant:gem1:gem2:gem3:gem4:suffixID:uniqueID:level:itemID- The item's [[docs/api_types#itemID|itemID]].enchant(optional) - Unique identifier of the enchantment applied to the item; not used elsewhere in the API.gem1,gem2,gem3,gem4(optional) - Unique identifiers of the enchantments provided by gems socketed in the item (not theitemIDs of the gems themselves); not used elsewhere in the API.suffixID(optional) - Identifies the specific variation represented for random-property items (e.g. "... of the Monkey", "... of Frost Protection", etc.). A positive number indicates a variation with specific stat values (e.g.1200= "of the Bear", 8 stamina 8 strength;1220= "of the Bear", 14 stamina 15 strength); a negative number indicates a type of variation, with actual stat values to be determined by decoding theuniqueID.uniqueID(optional) - A number used internally by the WoW client/server architecture to track a specific occurrence of an item: used for crafted items which display "<Made by Name>" in their tooltips and for random-property items. For items with a negativesuffixID, usingbit.band(uniqueID, 0xFFFF)reveals the factor used to calculate the item's stats.level- Level of the character linking the item; used for "Heirloom" items whose stats change based on the level of the character equipping them.
Type: inventoryID
Identifies an inventory slot used (mostly) for the equipping of items. Inventory ID numbers exist not only for the armor and weapon slots seen in the default UI's Character window, but also for bag slots, bank bag slots, the contents of the bank's main storage area, and the contents of the keyring. Inventory slots are not defined as constants in the default UI; to obtain the inventoryID for a slot, use one of the following functions:
Type: itemID
Uniquely identifies an item; usable with APIs such as GetItemInfo(). Also useful with database sites; e.g. item ID 19019.
Type: itemLocation
A bitfield describing the location of an item owned by the player. The following example code illustrates masks which can be compared with an itemLocation to determine the exact location described:
local ITEM_INVENTORY_PLAYER = 0x00100000
local ITEM_INVENTORY_BACKPACK = 0x00200000
local ITEM_INVENTORY_BAGS = 0x00400000
local ITEM_INVENTORY_BANK = 0x00800000
local MASK_BAG = 0xf00
local MASK_SLOT = 0x3f
local bagMap = {
[0x100] = 1,
[0x200] = 2,
[0x400] = 3,
[0x800] = 4,
}
local function ItemInBag(itemLocation)
if bit.band(itemLocation, ITEM_INVENTORY_BAGS) > 0 then
local bag = bagMap[bit.band(itemLocation, MASK_BAG)]
local slot = bit.band(itemLocation, MASK_SLOT)
return bag, slot
elseif bit.band(itemLocation, ITEM_INVENTORY_BACKPACK) > 0 then
local slot = bit.band(itemLocation, MASK_SLOT)
return 0, slot
end
end
local function ItemEquipped(itemLocation)
if bit.band(itemLocation, ITEM_INVENTORY_PLAYER) > 0 then
local slot = bit.band(itemLocation, MASK_SLOT)
return slot
end
end
Type: itemQuality
Indicates the quality (or rarity) of an item. Possible values and examples:
- Poor (gray): Broken I.W.I.N. Button
- Common (white): Archmage Vargoth's Staff
- Uncommon (green): X-52 Rocket Helmet
- Rare / Superior (blue): Onyxia Scale Cloak
- Epic (purple): Talisman of Ephemeral Power
- Legendary (orange): Fragment of Val'anyr
- Artifact / Heirloom (light yellow): Bloodied Arcanite Reaper
Type: itemString
Refers to the linktype:linkdata portion of an item link (the part containing the itemID, e.g. item:19019); see hyperlink for details.
Type: layer
One of the graphical layers present in World of Warcraft (presented from lowest to highest). Any graphics on the HIGHLIGHT layer are only displayed when the mouse is over the parent frame.
BACKGROUNDBORDERARTWORKOVERLAYHIGHLIGHT
Type: macroID
Index of one of the player's saved macros. Macros shared by all characters on player's account are indexed from 1 to MAX_ACCOUNT_MACROS; macros specific to the current character are indexed from MAX_ACCOUNT_MACROS + 1 to MAX_ACCOUNT_MACROS + MAX_CHARACTER_MACROS.
Type: rollID
The default user interface assigns a unique numeric identifier for all items that are able to be rolled on by the party. This identifier can be obtained by checking the rollID member of the specific group loot frame. For example: /run print(GroupLootFrame1.rollID).
Type: spellbookID
Index of a spell in the player's (or pet's) spellbook; usable with APIs such as GetSpellInfo().
Type: spellID
Globally and uniquely identifies a spell (and its rank); usable with APIs such as GetSpellInfo(). Also useful with database sites; e.g. spell ID 47471.
Type: standingID
Identifies a level of reputation:
- Hated
- Hostile
- Unfriendly
- Neutral
- Friendly
- Honored
- Revered
- Exalted
The default UI provides constants which can be helpful in displaying standing information.
- The localized name for the standing N can be found in the global variable
FACTION_STANDING_LABELN orFACTION_STANDING_LABELN_FEMALE; e.g.FACTION_STANDING_LABEL4 == "Neutral". Note: though the male (unlabeled) and female forms are the same in theenUSclient, the same is not true for other languages -- be sure to use the appropriate form for the character's gender. - Color values for each standing (as seen in reputation status bars in the default UI) can be found in the table
FACTION_BAR_COLORS.
Type: unitID
Used throughout the API to identify units of interest. Possible values:
player- The player him/herselfpet- The player's petvehicle- The vehicle currently controlled by the playertarget- The player's current targetfocus- The player's focused unit (as can be set by typing/focus name)mouseover- The unit currently under the mouse cursor (applies to both unit frames and units in the 3D world)npc- The unit the player is currently interacting with (via the Merchant, Trainer, Bank, or similar UI); not necessarily an NPC (e.g. also used in the Trade UI)party1toparty4- Another member of the player's party. Indices match the order party member frames are displayed in the default UI (party1is at the top,party4at the bottom), but not consistent among party members (i.e. if Thrall and Cairne are in the same party, the player Thrall sees asparty2may not be the same player Cairne sees asparty2).partypet1topartypet4- A pet belonging to another member of the player's partyraid1toraid40- A member of the player's raid group. Unlike with thepartytokens, one of theraidunit IDs will belong to the player. Indices have no relation to the arrangement of units in the default UI.raidpet1toraidpet40- A pet belonging to a member of the player's raid grouparena1toarena5- A member of the opposing team in an Arena match
A unitID can also be formed by appending "target" to an existing unitID, referring to that unit's target. This can be done repeatedly. For example, consider a raid situation where the token raid13 refers to a priest: raid13target might be a rogue the priest is healing, raid13targettarget might be the boss monster the rogue is attacking, and raid13targettargettarget might be the warrior tanking the boss.
Many (but not all) API functions that accept a unitID also accept the name of a unit (assuming that unit is in the player's party or raid). For example, UnitHealth("Cladhaire") will return the same value as UnitHealth("party1") if the unit party1 is the player named Cladhaire. In such situations, a unit's target can still be accessed by appending "-target"; e.g. UnitHealth("Cladhaire-target").