WoWInterface - View Single Post - Adding new script to pet journal buttons
View Single Post
06-10-21, 11:04 PM   #2
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,424
Where you're setting the OnClick for each button, you're using a fixed string to print.

Where is buttonName defined? If it's global and being overwritten before you get to click the that's what it's value will be. If it's local inside a chunk the OnClick handlers can't "see" then it will be nil or???

Lua Code:
  1. local index = 0
  2. while true do
  3.     index = index + 1
  4.     local buttonName = "PetJournalListScrollFrameButton" .. index
  5.     print(buttonName) -- debug --
  6.     local button = _G[buttonName]
  7.     if not button then break end
  8.     button:HookScript("OnClick", function(self)
  9.         print(self:GetName()) -- debug --
  10.     end)
  11. end
Seems to work.
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-10-21 at 11:17 PM.
  Reply With Quote