Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-14-13, 12:06 PM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
UnitGUID issue in flex mode?

Someone posted this error in the comments on my tooltip mod

Message: Interface\AddOns\rTooltip\core.lua:128: Usage: UnitGUID("unit")
Time: 09/14/13 18:55:34
Count: 8
Stack: [C]: in function `UnitGUID'
Interface\AddOns\rTooltip\core.lua:128: in function <Interface\AddOns\rTooltip\core.lua:126>
[C]: ?

Locals: (*temporary) = nil
What I'm doing is the following:
Lua Code:
  1. local unit = select(2, self:GetUnit()) or (GetMouseFocus() and GetMouseFocus():GetAttribute("unit")) or (UnitExists("mouseover") and "mouseover")
  2. local guid = UnitGUID(unit) or nil
  3. if not guid then return end
Full code: http://code.google.com/p/rothui/sour...p/core.lua#125

I tested UnitGUID(unitID). When entering an invalid unitID it just returns nil.
What could make the function fail? It works flawlessly in any case I know. No issues with cross-realms.

I have not tested Flex raids yet. Am I missing something?

*edit* ------------------------
Ok...I think I forgot to catch nil and type. So going to add:
Lua Code:
  1. if not unit or (unit and type(unit) ~= "string") then return end

This should do it.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-14-13 at 12:40 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » UnitGUID issue in flex mode?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off