Hello!
I'm scratching my head pretty badly trying to set up a simple (although advanced for me) addon to apply !Beautycase borders to various frames.
Right now I'm only focusing on Pitbull4 "player" and "target", as well as a custom panel created with kgPanels.
I got the frame names using the /fstack command, so I am sure they are correct.
Much appreciated if anyone would like to help me not go bald with this.
Here is the TOC for my addon:
Code:
## Interface: 80300
## Title: zBorders
## Notes: Module used by LerbUI to skin borders. Built upon and an extension of !Beautycase, created by Neav.
## Author: Lerb
## Dependencies: !Beautycase, Pitbull4, kgPanels, kgPanelsConfig
## Version: 8.3.0-1
zBorders.lua
And here is the code inside zBorders.lua:
Lua Code:
local f = CreateFrame("Frame")
f:RegisterEvent("VARIABLES_LOADED")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self)
-- Pitbull4 borders --
if "Pitbull4" then
f:SetScript("OnUpdate", function(self)
for _, pitframes in pairs({
PitBull4_Frames_Player,
PitBull4_Frames_Target,
}) do
if pitframes:IsShown() then
pitframes:CreateBeautyBorder(14)
pitframes:SetBeautyBorderPadding(3)
end
end
end)
end
-- kgPanels borders --
if "kgPanelsConfig" then
kgPanel1:CreateBeautyBorder(14)
kgPanel1:SetBeautyBorderPadding(3)
end
end)
When I log on, I am presented with the error below (only one error, no "spam"),
but all frames are actually skinned (border applied). Does this has something to do with load order? I thought setting dependencies would be enough for that.
**EDIT** If I remove the code for kgPanels, it works great (borders on Pitbull4, no errors), so it has something to do with those 4 lines of code is my guess.
**EDIT2** I've also tried using
if IsAddOnLoaded("Pitbull4") then instead of just
if "Pitbull4" then, but the results are exactly the same. I don't know which of these are the "norm" or the "best" to use?
Error (the lower one is from Bugger):
Code:
Message: Interface\AddOns\zBorders\zBorders.lua:27: attempt to index global 'kgPanel1' (a nil value)
Time: Fri Feb 14 17:08:34 2020
Count: 4
Stack: Interface\AddOns\zBorders\zBorders.lua:27: attempt to index global 'kgPanel1' (a nil value)
[string "@Interface\AddOns\zBorders\zBorders.lua"]:27: in function <Interface\AddOns\zBorders\zBorders.lua:6>
Locals: self = <unnamed> {
0 = <userdata>
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = "OnUpdate"
(*temporary) = 83914
(*temporary) = "attempt to index global 'kgPanel1' (a nil value)"
f = <unnamed> {
0 = <userdata>
}
Bugger:
Code:
4x zBorders\zBorders-8.3.0-1.lua:27: attempt to index global 'kgPanel1' (a nil value)
[string "@zBorders\zBorders-8.3.0-1.lua"]:27: in function <zBorders\zBorders.lua:6>