WoW API: UnitInRange

From AddOn Studio
Revision as of 15:36, 25 January 2011 by WoWWiki>Sirknala (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Will return nil for hostile units.

See also