View Single Post
04-28-23, 09:17 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,892
It has to do with the way the files are ordered in the .toc (again)

We changed it to XML first so the .lua code could "see" AMD_TabOnCharacterFrame

Now, when it's created, you're asking AMD_TabOnCharacterFrame to call a function in your .lua (which hasn't been loaded yet)

Instead of using an OnLoad script in the XML just do whatever you were going to do to AMD_TabOnCharacterFrame in the .lua.

Lua Code:
  1. hooksecurefunc("CharacterFrameTab_OnClick", function(self, button)
  2.     if self:GetID() == TabID then
  3.         ToggleCharacter("AMD_TabOnCharacterFrame")
  4.     end
  5. end)
  6. --[[
  7. function AMD_OnLoad(self)
  8.     print("AddOn loaded")
  9. end
  10. ]]--
  11.  
  12. -- Instead of the AMD_OnLoad function:
  13. AMD_TabOnCharacterFrame_NextButton:SetText("OnLoad Change")

Depending on what the end goal is there might be a better alternative but this should work for now.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote