WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Unit Existence: UnitExists vs UnitGUID (https://www.wowinterface.com/forums/showthread.php?t=56746)

stako 10-04-18 01:33 PM

Unit Existence: UnitExists vs UnitGUID
 
Having a look at the Blizzard_ArenaUI addon, there's a line to check for the existence of a unit:
Lua Code:
  1. if ( UnitGUID(self.unit) ) then --Use UnitGUID instead of UnitExists in case the unit is a remote update.

What does it mean by 'remote update' here and what's the difference between using UnitExists and UnitGUID when checking for the existence of a unit?

myrroddin 10-04-18 02:10 PM

UnitGUID requires the unit to actually be in the game, while UnitExists could be someone in the game or merely in remote chat. At least that's how I would interpret the intent. Also, UnitExists can sometimes fail when the player is in a loading screen, ie:// between worlds, whereas UnitGUID is assigned upon first logon and never changes until logout/exit.


All times are GMT -6. The time now is 06:11 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI