WoW:API UnitInRange: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{wowapi}} __NOTOC__ <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> Returns 1 if the unit is in range (40yds) and "Line of Sig...") |
|||
Line 31: | Line 31: | ||
<!-- Details not appropriate for the main description can go here. | <!-- Details not appropriate for the main description can go here. | ||
REMOVE the section if you're just going to restate the intro line! --> | REMOVE the section if you're just going to restate the intro line! --> | ||
: Returns 'false' for any unit not in party or raid. | |||
: Will return nil for hostile units. | : Will return nil for hostile units. | ||
==See also== | ==See also== | ||
* [[API IsSpellInRange]] | * [[API IsSpellInRange]] |
Revision as of 19:50, 20 February 2016
← WoW API < UnitInRange
Returns 1 if the unit is in range (40yds) and "Line of Sight" of most helpful spells, nil otherwise.
isTrue = UnitInRange("unit")
Arguments
- unit
- String - unitId to check.
Returns
- isTrue
- 1 or nil
Example
if UnitInRange("target") then print(UnitName("target") .. " is 40 yds away.") elseif not UnitInRange("target") then print(UnitName("target") .. " is not in range!") end
Result
FarfarawayDPS is 40 yds away. FarfarawayDPS is not in range!
Details
- Returns 'false' for any unit not in party or raid.
- Will return nil for hostile units.