Thread Tools Display Modes
11-07-20, 04:06 AM   #1
Grungra
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 14
Addon Howmany with error since new patch

Greets, having a problem with addon that got hit with the new api from patch. It's called howmany and you can find it in curseforge at:

https://www.curseforge.com/wow/addons/howmany

it gives the following error now when you collect any of the garrison resources in WoD or the resources for legion.

4x HowMany\Modules\HMLoot.lua:592: attempt to call global 'GetCurrencyListSize' (a nil value)
[string "@HowMany\Modules\HMLoot.lua"]:592: in function <HowMany\Modules\HMLoot.lua:584>
[string "@HowMany\Modules\HMLoot.lua"]:879: in function <HowMany\Modules\HMLoot.lua:871>
[string "@HowMany\Modules\HMLoot.lua"]:899: in function `filterFunc'
[string "@Prat-3.0-3.9.0\services\chatsections.lua"]:49: in function <Prat-3.0\services\chatsections.lua:41>
[string "@Prat-3.0-3.9.0\services\chatsections.lua"]:340: in function `SplitChatMessage'
[string "@Prat-3.0-3.9.0\addon\addon.lua"]:639: in function <Prat-3.0\addon\addon.lua:613>
[string "=(tail call)"]: ?
[string "@FrameXML\ChatFrame.lua"]:3031: in function `ChatFrame_OnEvent'
[string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>

Locals:
parserEvent = <table> {
moneyString = "|cffffffff|Hcurrency:824:0|h[Garrison Resources]|h|r"
isMoney = false
amount = "16"
recipientUnit = "player"
eventType = "currency"
OriginalText = "You receive currency: |cffffffff|Hcurrency:824:0|h[Garrison Resources]|h|r x16."
}
idx = nil
wasCurrency = false
(*temporary) = 1
(*temporary) = nil
(*temporary) = "attempt to call global 'GetCurrencyListSize' (a nil value)"
mod = <table> {
SetDefaultModuleLibraries = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:367
Enable = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:294
NewModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:235
EnableModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:332
modules = <table> {
}
CancelTimer = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:147
IterateEmbeds = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:442
defaultModuleLibraries = <table> {
}
TimeLeft = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:172
ScheduleRepeatingTimer = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:129
CancelAllTimers = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:160
SetDefaultModulePrototype = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:409
GetOptions = <function> defined @HowMany\Modules\HMLoot.lua:989
name = "HowMany_HMLoot"
IsEnabled = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:451
orderedModules = <table> {
}
ScheduleTimer = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:94
DisableModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:350
RegisterMessage = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:90
UnregisterMessage = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:153
defaultModuleState = true
canBeDisabled = true
baseName = "HowMany"
BAG_UPDATE_DELAYED = <function> defined @HowMany\Modules\HMLoot.lua:534
IsModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:217
db = <table> {
}
SetDefaultModuleState = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:387
OnInitialize = <function> defined @HowMany\Modules\HMLoot.lua:973
OnDisable = <function> defined @HowMany\Modules\HMLoot.lua:959
SetEnabledState = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:424
OnEnable = <function> defined @HowMany\Modules\HMLoot.lua:925
enabledState = true
ItemTimerCallback = <function> defined @HowMany\Modules\HMLoot.lua:475
RegisterEvent = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:90
UnregisterAllMessages = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:174
Disable = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:314
UnregisterAllEvents = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:174
SendMessage = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:59
IterateModules = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:437
Info = <function> defined @HowMany\Modules\HMLoot.lua:984
GetModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:210
GetName = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:279
moduleName = "HMLoot"
UnregisterEvent = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:153
modName = "HMLoot"
}
string_find = <function> defined =[C]:-1
ItemHash = <table> {
}
L = <table> {
Show Bags Total = "Show Bags Total"
Combine Similar Loot Messages = "Combine Similar Loot Message


The function that fails is this:
--------------------------------------------------------------------------------------------

local function HandleCurrency(parserEvent)

if ( not mod.db.profile.trackCurrency ) then return end

local idx, wasCurrency
wasCurrency = false
-- Debug
-- DEFAULT_CHAT_FRAME:AddMessage( parserEvent.moneyString );
for idx = 1, GetCurrencyListSize() do
local cname, ccount, citemID

cname, _, _, _, _, ccount, _, _, citemID = GetCurrencyListInfo(idx)
if cname ~= "Legion" and ccount ~= 0 then
local matchEnd = string_find(parserEvent.moneyString, cname)

-- Debug
-- DEFAULT_CHAT_FRAME:AddMessage( cname .. " " .. tostring(ccount) );

-- Check if a match was found.
if (matchEnd) then

ItemHash[parserEvent.moneyString] = nil -- We don't have to worry about the timer any more, so just forget it.
parserEven*****ssageDelayed = false -- we're not combining this message. Just let it go through
parserEvent.resultString = " " .. L["You now have"] .. " " .. ccount .. "."

wasCurrency = true -- don't bother to search any more
break
end
end
end

--------------------------------------------------------------------------

Maybe someone with the know how, can fix the function to fix the error.

Thanks.
  Reply With Quote
11-07-20, 04:40 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
wowpedia shows that that function has been moved to its own data table in 9.0

C_CurrencyInfo

Now whether just adding C_CurrencyInfo. in front of the function is enough I don't know. But worth a try.

https://wow.gamepedia.com/API_C_Curr...rrencyListSize

Seeing as the addon creator doesn't seem to have logged into Curse in two years you may have to adjust the addon yourself if you still need to use it.
__________________
  Reply With Quote
11-07-20, 08:44 PM   #3
Grungra
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 14
Thanks for the pointer to the new api, but it didn't work new error pops up. Guess either wait for author to maybe show up again, or hope someone posts a fix to the function.
  Reply With Quote
11-07-20, 09:14 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
A new error probably just means another error ie. more than 1 thing needs to be fixed.

(goes to check...)Looking at the version just downloaded from the link you posted, the GetCurrencyListSize line is 578 not 592. which would indicate your version may be an older version. Changing GetCurrencyListSize() to C_CurrencyInfo.GetCurrencyListSize() in the just downloaded version doesn't seem to throw any errors (so far).

It does use Ace libraries (in the addons \lib folder) so if you don't have addons with the latest version you would need to update those.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-07-20 at 09:21 PM.
  Reply With Quote
11-08-20, 03:22 AM   #5
Grungra
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 14
Thanks for the input, the difference in line numbers happens because I've added the different reputations that have shown up since the addon was last updated. But to be in the same page, reverted back to the last version, updated ace 3 files, after making the correction to line 578 now the error is:

1x HowMany\Modules\HMLoot.lua:581: attempt to call global 'GetCurrencyListInfo' (a nil value)
[string "@HowMany\Modules\HMLoot.lua"]:581: in function <HowMany\Modules\HMLoot.lua:570>
[string "@HowMany\Modules\HMLoot.lua"]:854: in function <HowMany\Modules\HMLoot.lua:846>
[string "@HowMany\Modules\HMLoot.lua"]:874: in function `filterFunc'
[string "@Prat-3.0-3.9.0\services\chatsections.lua"]:49: in function <Prat-3.0\services\chatsections.lua:41>
[string "@Prat-3.0-3.9.0\services\chatsections.lua"]:340: in function `SplitChatMessage'
[string "@Prat-3.0-3.9.0\addon\addon.lua"]:639: in function <Prat-3.0\addon\addon.lua:613>
[string "=(tail call)"]: ?
[string "@FrameXML\ChatFrame.lua"]:3031: in function `ChatFrame_OnEvent'
[string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>

Locals:
parserEvent = <table> {
moneyString = "|cffffffff|Hcurrency:824:0|h[Garrison Resources]|h|r"
isMoney = false
amount = "20"
recipientUnit = "player"
eventType = "currency"
OriginalText = "You receive currency: |cffffffff|Hcurrency:824:0|h[Garrison Resources]|h|r x20."
}
idx = nil
wasCurrency = false
(for index) = 1
(for limit) = 8
(for step) = 1
idx = 1
cname = nil
ccount = nil
citemID = nil
(*temporary) = nil
(*temporary) = 1
(*temporary) = "attempt to call global 'GetCurrencyListInfo' (a nil value)"
mod = <table> {
SetDefaultModuleLibraries = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:367
Enable = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:294
NewModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:235
EnableModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:332
modules = <table> {
}
CancelTimer = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:147
IterateEmbeds = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:442
defaultModuleLibraries = <table> {
}
TimeLeft = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:172
ScheduleRepeatingTimer = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:129
CancelAllTimers = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:160
SetDefaultModulePrototype = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:409
GetOptions = <function> defined @HowMany\Modules\HMLoot.lua:964
name = "HowMany_HMLoot"
IsEnabled = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:451
orderedModules = <table> {
}
ScheduleTimer = <function> defined @Ace3\AceTimer-3.0\AceTimer-3.0.lua:94
DisableModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:350
RegisterMessage = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:90
UnregisterMessage = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:153
defaultModuleState = true
canBeDisabled = true
baseName = "HowMany"
BAG_UPDATE_DELAYED = <function> defined @HowMany\Modules\HMLoot.lua:520
IsModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:217
db = <table> {
}
SetDefaultModuleState = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:387
OnInitialize = <function> defined @HowMany\Modules\HMLoot.lua:948
OnDisable = <function> defined @HowMany\Modules\HMLoot.lua:934
SetEnabledState = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:424
OnEnable = <function> defined @HowMany\Modules\HMLoot.lua:900
enabledState = true
ItemTimerCallback = <function> defined @HowMany\Modules\HMLoot.lua:461
RegisterEvent = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:90
UnregisterAllMessages = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:174
Disable = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:314
UnregisterAllEvents = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:174
SendMessage = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:59
IterateModules = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:437
Info = <function> defined @HowMany\Modules\HMLoot.lua:959
GetModule = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:210
GetName = <function> defined @Ace3\AceAddon-3.0\AceAddon-3.0.lua:279
moduleName = "HMLoot"
UnregisterEvent = <function> defined @Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:153
modName = "HMLoot"
}
string_find = <function> defined =[C]:-1
ItemHash = <table> {
}
L = <table> {
Show

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

After applying the same fix (C_CurrencyInfo.) to the global, the new error is:


1x HowMany\Modules\HMLoot.lua:583: bad argument #2 to 'string_find' (string expected, got table)
[string "=[C]"]: ?
[string "@HowMany\Modules\HMLoot.lua"]:583: in function <HowMany\Modules\HMLoot.lua:570>
[string "@HowMany\Modules\HMLoot.lua"]:854: in function <HowMany\Modules\HMLoot.lua:846>
[string "@HowMany\Modules\HMLoot.lua"]:874: in function `filterFunc'
[string "@Prat-3.0-3.9.0\services\chatsections.lua"]:49: in function <Prat-3.0\services\chatsections.lua:41>
[string "@Prat-3.0-3.9.0\services\chatsections.lua"]:340: in function `SplitChatMessage'
[string "@Prat-3.0-3.9.0\addon\addon.lua"]:639: in function <Prat-3.0\addon\addon.lua:613>
[string "=(tail call)"]: ?
[string "@FrameXML\ChatFrame.lua"]:3031: in function `ChatFrame_OnEvent'
[string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>

Locals:
(*temporary) = "|cffffffff|Hcurrency:824:0|h[Garrison Resources]|h|r"
(*temporary) = <table> {
canEarnPerWeek = false
quantityEarnedThisWeek = 0
isHeaderExpanded = true
isTradeable = false
maxQuantity = 0
maxWeeklyQuantity = 0
isHeader = true
name = "Warlords of Draenor"
isTypeUnused = false
isShowInBackpack = false
discovered = false
quantity = 0
quality = 0
}
(*temporary) = "string expected, got table"

------------------------------------------------------------------------------------------

Any insights on what would be a fix for the latest error? Thanks in advance.

(edit) I should add, the errors only happen if you collect some of the garrison resources, other loot such as items, money etc will parse normal.

Last edited by Grungra : 11-08-20 at 03:25 AM.
  Reply With Quote
11-08-20, 06:19 AM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
You would have to post up the line that has been reported as the parameter to the string.find has clearly changed status since its last successful use.

debug the parameter values to the string.find function using print(xxx) and see if they are values or tables. They should be values.. either string or numerical. If it returns a table then you will have to identify what value within that table ( likely problem ) that now needs to be passed into the function.

If it is the table shown in the local list, identify which of the elements the function was supposed to be using and put that in there instead.
__________________
  Reply With Quote
11-08-20, 07:19 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
C_CurrencyInfo.GetCurrencyListInfo returns a table of information now rather than the parameters the old version returned
Instead of:
Code:
cname, _, _, _, _, ccount, _, _, citemID = GetCurrencyListInfo(idx)
use:
Lua Code:
  1. local info = C_CurrencyInfo.GetCurrencyListInfo(idx)
  2. cname = info.name
  3. ccount = info.quantity
  4. -- citemID doesn't seem to be used so...
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
11-08-20, 11:21 AM   #8
Grungra
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 14
Thanks Fizzlemizz and everyone else for the help, that seems to have worked, it's now parsing resources as before. I'll post the fix on curse comments and give you the credit for it. Take care.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Addon Howmany with error since new patch

Thread Tools
Display Modes

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