WoW API < TargetUnit

Selects the specified id as the current target.

TargetUnit("unit");

Parameters[edit | edit source]

Arguments[edit | edit source]

("unit")
unit 
String - The unitId to select as a target.

Returns[edit | edit source]

nil

Example[edit | edit source]

When the player changes his target there is a small delay before the global variable 'playertarget' is updated. This can be exploited and used for restoring your old target.
TargetUnit("unit")
CastSpell()
TargetUnit("playertarget")

Result[edit | edit source]

This will restore your old target because of the delay. It will not clear your target if you didnt have one.

Details[edit | edit source]

Selects the specified id as the current target. One can use any of the defined unitId values.
Community content is available under CC-BY-SA unless otherwise noted.