WoW API: UnitStat

From AddOn Studio
Jump to navigation Jump to search

WoW API < UnitStat

Returns info about one of the unit's stats (strength, agility, stamina, intellect, spirit).

base, stat, posBuff, negBuff = UnitStat("unit", statID);

Parameters[edit]

Arguments[edit]

unit
String - The UnitId to get information from. (Only works for "player" and "pet". Will work on "target" as long as it is equal to "player")
statID
Number - An internal id corresponding to one of the stats.
  1. Strength
  2. Agility
  3. Stamina
  4. Intellect
  5. Spirit

Return[edit]

base, stat, posBuff, negBuff
base
Number - The unit's base stat.
stat
Number - The unit's current stat.
posBuff
Number - Any positive buffs applied to the stat.
negBuff
Number - Any negative buffs applied to the stat.

Example[edit]

local base, stat, posBuff, negBuff = UnitStat("player",1);
DEFAULT_CHAT_FRAME:AddMessage("Your current Strength is ".. stat);

Result[edit]

A chat message stating your current strength is displayed