If buttonName was global, each click would print the last thing it was set to at the time of the click. If say another addon was using buttonName accidently as a global, it could be set to anything at any time before you clicked.
printing self:GetName() just prints that buttons name so you're not relying on having some possibly dubiously scoped variable set to the right name at the right time.
Last edited by Fizzlemizz : 06-11-21 at 12:09 AM.
|