WoW:API UnitHealthMax: Difference between revisions

No edit summary
 
m (Move page script moved page API UnitHealthMax to API UnitHealthMax without leaving a redirect)
 
(10 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<center>'''UnitHealthMax''' ''-Documentation by [[User:Danboo|danboo]]-''</center>
{{wowapi}} __NOTOC__
 
Returns the maximum health of the specified unit.
Returns the maximum health, in points, of the specified unit.


  local max_health = UnitHealthMax(unit);
  local max_health = UnitHealthMax(unit);


----
==Parameters==
;''Arguments''
:;unit : [[UnitId]] -  the unit whose max health to query.
 
:(String unit)
 
:;arg1 : the unit's max health to query
 
----
;''Returns''
 
:max_health
:;max_health : the maximum health of the specified unit
 
----
;''Example''
local max_health = UnitHealth("player");
ChatFrame1:AddMessage('player max health: ' .. max_health);
 
;''Result''
Prints the player's maximum health to the chat frame as 'player max health: 100'.
 
----
;''Description''


: Returns the maximum health, in points, of the specified unit.
==Returns==
:;max_health : Integer - the maximum health of the specified unit, returns 0 if the specified unit does not exist (eg. "target" given but there is no target)


----
==Example==
{{Template:WoW API}}
Print the maximum health of ''player'' and ''target'' units to the chat window:
ChatFrame1:AddMessage('Player max health: ' .. UnitHealthMax("player") .. " HP");
ChatFrame1:AddMessage('Target max health: ' .. UnitHealthMax("target") .. " HP");

Latest revision as of 04:47, 15 August 2023

WoW API < UnitHealthMax

Returns the maximum health of the specified unit.

local max_health = UnitHealthMax(unit);

Parameters

unit
UnitId - the unit whose max health to query.

Returns

max_health
Integer - the maximum 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 maximum health of player and target units to the chat window:

ChatFrame1:AddMessage('Player max health: ' .. UnitHealthMax("player") .. " HP");
ChatFrame1:AddMessage('Target max health: ' .. UnitHealthMax("target") .. " HP");