View Single Post
01-19-22, 02:54 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Good job. If you would like to simplify it a little, you can do just this:
Lua Code:
  1. local ShrinkNameplate = CreateFrame("frame")
  2. ShrinkNameplate:RegisterEvent("PLAYER_ENTERING_WORLD")
  3.  
  4. ShrinkNameplate:SetScript("OnEvent", function()
  5.     C_NamePlate.SetNamePlateFriendlySize(60, 30)
  6. end)
Since you only have 1 event registered to your frame, you don't have to check to see which event just fired. And since you are not using any of the arguments passed through to your OnEvent function, you don't need to save them to any variables. Lastly, you don't need to give your frame a global name, since you won't be accessing it outside of your addon.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote