WoW:API UnitHealth: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
  <center>'''UnitHealth''' ''-Documentation by [[User:Danboo|danboo]]-''</center>
  <center>'''UnitHealth''' ''-Documentation by [[User:Danboo|danboo]]-''</center>


Returns the current health, in points, of the specified unit.
Returns the current health of the specified unit, in percentage, for:
 
*target
*mouseover
 
Otherwise in points.


  local health = UnitHealth(unit);
  local health = UnitHealth(unit);
Line 21: Line 26:
;''Example''
;''Example''
  local health = UnitHealth("player");
  local health = UnitHealth("player");
local health2 = UnitHealth("target");
  ChatFrame1:AddMessage('player health: ' .. health);
  ChatFrame1:AddMessage('player health: ' .. health);
ChatFrame1:AddMessage('target health: ' .. health .. "%");


;''Result''
;''Result''
  Prints the player's health to the chat frame as 'player health: 90'.
  Prints the player's and target's health to the chat frame as
'player health: 900' and 'target health: 80%'.


----
----
;''Description''
;''Description''


: Returns the current health, in points, of the specified unit.
: Returns the current health of the specified unit, in percentage, for:
 
*target
*mouseover
 
Otherwise in points.


----
----
{{Template:WoW API}}
{{Template:WoW API}}

Revision as of 17:53, 7 December 2004

UnitHealth -Documentation by danboo-

Returns the current health of the specified unit, in percentage, for:

  • target
  • mouseover

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 health: ' .. 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, in percentage, for:
  • target
  • mouseover

Otherwise in points.


Template:WoW API