WoW API type: notation and conventions

From AddOn Studio
Jump to navigation Jump to search

Links from World of Warcraft API et al[edit]

Example API listing[edit]

  • SetMapZoom(continentIndex[, zoneIndex])   - Sets the current world map to a specific continent and optionally zone.
This function takes one or two arguments. The square brackets indicate that the second argument is optional.

Example API with string argument[edit]

The quotes around the arguments in this function means that the parameter is a string. It does not mean that the argument is literally "channel" or "name".

Example API with described data type (string)[edit]

  • TargetUnit("unit")   - Selects the specified id as the current target.

Example of an UI Object (widget) method[edit]

This example shows that the SetAllPoints() function is called as a method function on a LayoutFrame object. The arguemnt is either a frame, or a frame name (string).

Link Code Examples[edit]

: [[API SetMapZoom|SetMapZoom]](continentIndex[,zoneIndex])   - Description
Pages describing individual API functions are named on the form "API FunctionName" (with no argument information).
: [[API LayoutFrame GetHeight|LayoutFrame:GetHeight]]()   - Description
Pages describing individual widget methods are named on the form "API ObjectType FunctionName" (with no argument information).

Link Prefixes[edit]

  • PROTECTED - function exists, but is protected for Blizzard only code.
If the page exists, put {{protectedapi|<version when it was protected>|<extra info, if appropriate>}} at the top
  • REMOVED - indicates that the function has been removed from the API.
Removed functions should only be listed in Category:World of Warcraft API/Removed Functions
If the page exists, put {{removedapi|<version when it was removed>|<what to use instead, if appropriate>}} at the top
  • UI - indicates that the function is provided by the FrameXML UI code, rather than the core API.
If the page exists, put {{framexmlfunc|<FrameXML/FileNameWhereFunctionIs.lua>}} at the top

Data and Argument Types[edit]

The API uses special values for some function arguments, the commonly used types are:


API types < notation and conventions

This is the main WoW API 'value type' reference. The World of Warcraft API uses rather complex values using Lua native types for some of its parameters and return values. Rather than re-explain them every time they're used. This reference provides list of 'distinct' Lua based data types used in WoW.


See Category:API types for possibly a more complete list.

Simple types[edit]

nil - the Lua 'nil' type. a type, or variable state, which has no value
boolean - a Lua 'boolean', which holds Lua 'false' or 'true' values
Boolean - an old WoW API 'boolean', which holds number '1' or 'nil' values.
number - a regular Lua number, which for WoW is a 'double' size floating point number
string - a regular Lua string, which is always 1 byte per char. in WoW, non-ASCII chars are encoded utf-8.
function - a regular Lua function, which any variable can reference.
table - a regular Lua table, which any variable can reference.

Complex types[edit]

actionSlot - Action button slot numbers, 120 in total.
auctionSortId - An identifier for sorting columns in the auction house.
auctionTypeId - An identifier specifying which type of auction to operate on.
bagId - Numbers representing bags you carry, bank bags, bank window, etc
bagType - A bit type for bag types an item can go into, or item types a bag can carry. (added 2.4.0)
chatTypeId - An identifier for the different chat destination types.
emoteToken - System names of voice/action emotes
enchantString - An enchant id.
enchantLink - A string that will be clickable, if shown in-game, contains an enchantString.
instanceMapId - A unique numeric identifier for instance maps used by the WoW API
inventorySlotName - Names of inventory slots.
inventorySlotId - Current mappings of slot names to numbers. May change.
itemEquipLoc - String representation of where an item may be equipped ["INVTYPE_HEAD", ...]
itemString - An item id with data about enchants, "of" type bonuses, and the item's creator.
itemLink - A string that will be clickable if shown in-game, contains an itemString.
itemType - String classification of an item, ["Armor", "Consumable", ...]
lootMethod - An identifier for the different looting methods (group loot, need before greed, etc)
lfgCategoryType - a type for choosing LFG type (added 5.0.4)
mapId - A unique numeric identifier for zone maps used by the WoW API
partyCategoryType - a type for choosing group instance type (added 5.0.4)
playerName - The name of a player.
questLink - A string that will be clickable, if shown in-game, contains a questString.
questString - A quest id with data about the quest, including the level and quest title.
raidIndex - A number between 1 and 40
specializationID - Specialization ID
standingId - Numeric encoding of faction standing.
unitId - An identifier which specifies one of the units the API may reference ["target", "party1", ...]
unitFlag - A bit type of relationships between the player and a unit in the combat log (added 2.4.0)

</onlyinclude>Category:API types has the full list. (Though if something there is not available here: please list it!)

See also[edit]