silverwind / idTip

WoW Addon: Adds IDs to the ingame tooltips
BSD 2-Clause "Simplified" License
41 stars 32 forks source link

10.1 PTR, bad argument to ipairs #94

Closed Debuggernaut closed 1 year ago

Debuggernaut commented 1 year ago
Time: Sun Apr 30 13:43:11 2023
Count: 42
Stack: Interface/AddOns/idTip/idTip.lua:113: bad argument #1 to 'ipairs' (table expected, got nil)
[string "=[C]"]: in function `ipairs'
[string "@Interface/AddOns/idTip/idTip.lua"]:113: in function <Interface/AddOns/idTip/idTip.lua:112>
[string "@Interface/AddOns/idTip/idTip.lua"]:134: in function <Interface/AddOns/idTip/idTip.lua:127>
[string "=(tail call)"]: ?
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:162: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:157>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:179: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:178>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:218: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:208>
[string "=[C]"]: in function `SetAttribute'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:243: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:236>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:389: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:339>
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:336: in function `ProcessInfo'
[string "@Interface/FrameXML/GameTooltip.lua"]:1092: in function `SetWorldCursor'
[string "@Interface/FrameXML/UIParent.lua"]:1498: in function <Interface/FrameXML/UIParent.lua:1421>

Locals: (*temporary) = nil
(*temporary) = "table expected, got nil"
 = <function> defined =[C]:-1

I tried to work around it with a nil check, but that just made it so the addon doesn't do anything, haha. I dunno if this will be a problem when the patch goes live, could just be a PTR-specific thing, don't have much PTR experience

Wanny commented 1 year ago

Tested with the patch now Live and it happens as well. In fact there's two similar errors but referencing different functions :

Message: Interface/AddOns/idTip/idTip.lua:113: bad argument #1 to 'ipairs' (table expected, got nil)
Time: Tue May  2 17:01:07 2023
Count: 309
Stack: Interface/AddOns/idTip/idTip.lua:113: bad argument #1 to 'ipairs' (table expected, got nil)
[string "=(tail call)"]: ?
[string "=[C]"]: ?
[string "=[C]"]: in function `ipairs'
[string "@Interface/AddOns/idTip/idTip.lua"]:113: in function <Interface/AddOns/idTip/idTip.lua:112>
[string "@Interface/AddOns/idTip/idTip.lua"]:130: in function <Interface/AddOns/idTip/idTip.lua:127>
[string "=(tail call)"]: ?
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:162: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:157>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:179: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:178>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:218: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:208>
[string "=[C]"]: in function `SetAttribute'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:243: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:236>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:389: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:339>
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:336: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:335>
[string "=(tail call)"]: ?
[string "=[C]"]: in function `SetAction'
[string "@Interface/FrameXML/ActionButton.lua"]:913: in function `UpdateTooltip'
[string "@Interface/FrameXML/GameTooltip.lua"]:600: in function <Interface/FrameXML/GameTooltip.lua:593>

Locals: (*temporary) = 0.034000
(*temporary) = <function> defined =[C]:-1
Message: Interface/AddOns/idTip/idTip.lua:113: bad argument #1 to 'ipairs' (table expected, got nil)
Time: Tue May  2 17:02:26 2023
Count: 113
Stack: Interface/AddOns/idTip/idTip.lua:113: bad argument #1 to 'ipairs' (table expected, got nil)
[string "=(tail call)"]: ?
[string "=[C]"]: ?
[string "=[C]"]: in function `ipairs'
[string "@Interface/AddOns/idTip/idTip.lua"]:113: in function <Interface/AddOns/idTip/idTip.lua:112>
[string "@Interface/AddOns/idTip/idTip.lua"]:134: in function <Interface/AddOns/idTip/idTip.lua:127>
[string "=(tail call)"]: ?
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:162: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:157>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:179: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:178>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:218: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:208>
[string "=[C]"]: in function `SetAttribute'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:243: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:236>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:389: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:339>
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:336: in function `ProcessInfo'
[string "@Interface/FrameXML/GameTooltip.lua"]:1092: in function `SetWorldCursor'
[string "@Interface/FrameXML/UIParent.lua"]:1498: in function <Interface/FrameXML/UIParent.lua:1421>

Locals: (*temporary) = <function> defined =[C]:-1
Ellucens commented 1 year ago

I updated the addFromData function in idTip.lua as follows. It made the error go away and provides the expected tooltip for inventory items and NPCs. It looks like data.args is gone now and there are now id and guid items directly in the data table.

local function addFromData(tooltip, data, kind)
    if kind == kinds.unit and data.guid then
      local id = tonumber(data.guid:match("-(%d+)-%x+$"), 10)
      if id and data.guid:match("%a+") ~= "Player" then addLine(tooltip, id, kind) end
    else
      if data.id then
        addLine(tooltip, data.id, kind)
      end
    end
end
silverwind commented 1 year ago

Thanks for digging that out, of course the API Changes don't list this change, but it appears to work on a basic level.