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:
local unit = select(2, self:GetUnit()) or (GetMouseFocus() and GetMouseFocus():GetAttribute("unit")) or (UnitExists("mouseover") and "mouseover")
local guid = UnitGUID(unit) or nil
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:
if not unit or (unit and type(unit) ~= "string") then return end
This should do it.