WoW:API UnitHealth: Difference between revisions
Jump to navigation
Jump to search
UnitHealth -Documentation by danboo-
m (Just edited a small part in the example) |
mNo edit summary |
||
Line 39: | Line 39: | ||
;''Description'' | ;''Description'' | ||
: Returns the current health of the specified unit. The health is returned in real points only if the unit is in the player's party. Otherwise, a percentage is returned (0-100). (Note, that the player, the player's pet, and any | : Returns the current health of the specified unit. The health is returned in real points only if the unit is in the player's group (party or raid). Otherwise, a percentage is returned (0-100). (Note, that the player, the player's pet, and any group member pets are considered to be in the group.) | ||
---- | ---- | ||
{{WoW API}} | {{WoW API}} |
Revision as of 18:37, 29 September 2006
Returns the current health of the specified unit, in percentage, for:
- target
- mouseover
- pet if pet is charmed/enslaved
Otherwise in points.
local health = UnitHealth(unit);
- Arguments
- (String unit)
- arg1
- the unit's health to query
- Returns
- health
- health
- the current health of the specified unit
- Example
local health = UnitHealth("player"); local health2 = UnitHealth("target"); ChatFrame1:AddMessage('player health: ' .. health); ChatFrame1:AddMessage('target health2: ' .. health .. "%");
- Result
Prints the player's and target's health to the chat frame as 'player health: 900' and 'target health: 80%'.
- Description
- Returns the current health of the specified unit. The health is returned in real points only if the unit is in the player's group (party or raid). Otherwise, a percentage is returned (0-100). (Note, that the player, the player's pet, and any group member pets are considered to be in the group.)