WoW:API UnitHealth: Difference between revisions
Jump to navigation
Jump to search
(added info about 0 result for non existing target, corrected the example) |
|||
Line 4: | Line 4: | ||
==Parameters== | ==Parameters== | ||
:;unit : [[UnitId]] - identifies the unit to query health for | |||
:;unit : [[UnitId]] - the unit | |||
==Returns== | |||
:;health : Integer - current health of the specified unit. | :;health : Integer - current health of the specified unit, returns 0 if the specified unit does not exist (eg. "target" given but there is no target) | ||
==Example== | ==Example== | ||
Print the target's health to the chat frame: | |||
DEFAULT_CHAT_FRAME:AddMessage( "target health ="..UnitHealth("target") ) | |||
Revision as of 12:25, 12 October 2007
← WoW API < UnitHealth
Returns the current health of the specified unit. Returns the exact hitpoints for friendly players and pets in your raid/party, percentages otherwise.
local health = UnitHealth(unit);
Parameters
- unit
- UnitId - identifies the unit to query health for
Returns
- health
- Integer - current health of the specified unit, returns 0 if the specified unit does not exist (eg. "target" given but there is no target)
Example
Print the target's health to the chat frame:
DEFAULT_CHAT_FRAME:AddMessage( "target health ="..UnitHealth("target") )