WoW API < UnitInRange

Returns 1 if the unit is in range of most helpful spells (40yds) and in a group / raid with you, otherwise nil.

isTrue = UnitInRange("unit")

Arguments[edit | edit source]

unit
String - unitId to check.

Returns[edit | edit source]

isTrue
1 or nil

Example[edit | edit source]

if UnitInRange("target") then
    print(UnitName("target") .. " is 40 yds away.")
else
    print(UnitName("target") .. " is not in range!")
end

Result[edit | edit source]

FarfarawayDPS is 40 yds away.
FarfarawayDPS is not in range!

Details[edit | edit source]

Returns 'false' for any unit not in party or raid.
Will return nil for hostile units.

See also[edit | edit source]

Community content is available under CC-BY-SA unless otherwise noted.