WoW:API UnitInRange: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:


<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
<!-- 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 Sight" of most helpful spells, nil otherwise.
Returns 1 if the unit is in range of most helpful spells (40yds) and in a group / raid with you, otherwise nil.


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
Line 9: Line 9:
== Arguments ==
== Arguments ==
<!-- List each argument, together with its type -->
<!-- List each argument, together with its type -->
;unit : String - [[unitId]] to check.
;unit
: String - [[unitId]] to check.


== Returns ==
== Returns ==
<!-- List each return value, together with its type -->
<!-- List each return value, together with its type -->
;isTrue : 1 or nil
;isTrue
: 1 or nil


== Example ==
== Example ==

Revision as of 20:17, 13 June 2018

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

unit
String - unitId to check.

Returns

isTrue
1 or nil

Example

if UnitInRange("target") then
    print(UnitName("target") .. " is 40 yds away.")
else
    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.

See also