WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   How can I fix this argument in LUA (https://www.wowinterface.com/forums/showthread.php?t=53804)

Bmw309894 07-03-16 11:27 AM

How can I fix this argument in LUA
 
I am using an old UI but with updated addons and I've only come across one issue and here it is.

Message: ...rface\AddOns\DoomKitty\modules\datatexts\friends.lua:27: bad argument #4 to 'format' (string expected, got nil)
Time: 07/03/16 13:07:17
Count: 10
Stack: [C]: in function `format'
...rface\AddOns\DoomKitty\modules\datatexts\friends.lua:27: in function <...rface\AddOns\DoomKitty\modules\datatexts\friends.lua:10>

Locals: (*temporary) = "%s | %s (%s)"
(*temporary) = "|Kf64|kIronWill|k"
(*temporary) = "IronWill#1602"
(*temporary) = nil
(*temporary) = "string expected, got nil"



Here is the set of strings it is referring to:

local function CreateTooltip()
tool:SetScript("OnEnter", function(this) -------------THIS IS NUMBER 10
GameTooltip:SetOwner(this)
GameTooltip:AddLine("Friends Online")

GameTooltip:AddLine(" ")

for k,v in pairs(friendList) do
local name, lvl, class, area, status, note = v[1], v[2], v[3], v[4], v[5], v[6]
local lineL = string.format("%s %s %s", lvl, name, status or "")
local lineR = string.format("%s", area or "")

GameTooltip:AddDoubleLine(lineL, lineR)
end
GameTooltip:AddLine(" ")

for k,v in pairs(BNetList) do
local BNid, BNname, battleTag, toonname, client, status, broadcast, note = v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]
local lineL = string.format("|cffecd672%s|r |cffffffff|| |cffecd672%s|r |cffffffff(%s)|r", BNname, battleTag, toonname) ------THIS IS NUMBER 27
local lineR = string.format("|cffffffff%s%s|r", status or "", client or "")

GameTooltip:AddDoubleLine(lineL, lineR)
end

GameTooltip:Show()
end)
tool:SetScript("OnLeave", function(this) if (GameTooltip:IsShown()) then GameTooltip:Hide() end end)
tool:SetScript("OnMouseDown", function(this, button)
if (not InCombatLockdown()) then
ToggleFriendsFrame(1)
end
end)
end



I do not know how to edit the string properly so that it does not mess up when I mouse over it. Any chance for some help fixing this?

Kanegasi 07-03-16 10:11 PM

Easy fix: on that line, change toonname to

toonname or ""

This fix will make the error go away but you might lose the toonname display of your bnet friends.

Difficult fix: since I haven't looked at DoomKitty, I don't know how many files it uses or how involved the code is, so this could be tedious. Find all of the following function names and change them according to the arrows:

Code:

BNGetToonInfo -> BNGetGameAccountInfo
BNGetFriendToonInfo -> BNGetFriendGameAccountInfo
BNGetNumFriendToons -> BNGetNumFriendGameAccounts

This was a Blizzard change in 6.2.4. I'm assuming that DoomKitty is using those and since it's a discontinued addon, those functions are probably the old ones.

Bmw309894 07-04-16 11:30 AM

Quote:

Originally Posted by Kanegasi (Post 316150)
Easy fix: on that line, change toonname to

toonname or ""

This fix will make the error go away but you might lose the toonname display of your bnet friends.

Difficult fix: since I haven't looked at DoomKitty, I don't know how many files it uses or how involved the code is, so this could be tedious. Find all of the following function names and change them according to the arrows:

Code:

BNGetToonInfo -> BNGetGameAccountInfo
BNGetFriendToonInfo -> BNGetFriendGameAccountInfo
BNGetNumFriendToons -> BNGetNumFriendGameAccounts

This was a Blizzard change in 6.2.4. I'm assuming that DoomKitty is using those and since it's a discontinued addon, those functions are probably the old ones.

I changed the things over as you said and it appears to be working fine now. I found another error but I need to get it to appear again before I know what the code problem is. for now I just use bug grabber and its fine but I think it only happen when I receive loot in a dungeon. It may have something to do with the pop up showing I won the loot. I'll check back later when I find out more. Many thanks good sir.


All times are GMT -6. The time now is 05:37 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI