Duplicate realm table in BagBrother SV file (normalized name + real name)
tflo opened this issue · 1 comments
Bagnon 10.0.14; WoW Retail 10.0.2 (47067) enUS
My BagBrother.lua has a duplicate realm table, one with the normalized realm name, the other with the real realm name. It looks like this:
BrotherBags = {
["AzjolNerub"] = { <table> },
["Azjol-Nerub"] = { <table> },
}
(You find the entire file attached at the bottom of the post.)
This does not seem to affect the functionality, but of course it doubles the amount of data.
I guess this is because in Startup.lua, line 36, you are creating the real realm name with GetRealmName()
, whereas in LibItemCache-2.0.lua, line 38, you are working with normalized realm names via GetAutoCompleteRealms()
, and maybe at other locations too, I haven't checked.
In any case, I was able to stop the creation of the duplicate table (while keeping the cache intact) by…
- using
GetNormalizedRealmName()
in Startup.lua, and - moving the two functions from the ADDON_LOADED event to the PLAYER_LOGIN event (since
GetNormalizedRealmName()
seems to be not working before PLAYER_LOGIN).
Here the diff:
*** /Users/tom/_Tmp ƒ/Startup--original.lua 2022-12-17 17:24:38.000000000 +0100
--- /Users/tom/_Tmp ƒ/Startup.lua 2022-12-17 17:17:14.000000000 +0100
***************
*** 27,39 ****
function Brother:ADDON_LOADED()
self:RemoveEvent('ADDON_LOADED')
- self:StartupCache()
- self:SetupCharacter()
end
function Brother:StartupCache()
local Player = UnitName('player')
! local Realm = GetRealmName()
BrotherBags = BrotherBags or {}
BrotherBags[Realm] = BrotherBags[Realm] or {}
--- 27,37 ----
function Brother:ADDON_LOADED()
self:RemoveEvent('ADDON_LOADED')
end
function Brother:StartupCache()
local Player = UnitName('player')
! local Realm = GetNormalizedRealmName()
BrotherBags = BrotherBags or {}
BrotherBags[Realm] = BrotherBags[Realm] or {}
***************
*** 56,61 ****
--- 54,61 ----
function Brother:PLAYER_LOGIN()
self:RemoveEvent('PLAYER_LOGIN')
+ self:StartupCache()
+ self:SetupCharacter()
self:SetupEvents()
self:UpdateData()
end
This is not meant as a solution, just a verification that the GetRealmName()
in Startup.lua is causing the second table.
– Tom