Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-06-22, 01:39 PM   #1
cosmic_kid
A Murloc Raider
Join Date: Oct 2021
Posts: 9
Question Frame:SetScript() Not Working?

I am about to lose my mind with this issue. I've done it a million different ways, but cannot for the life of me get this to work.

I'm simply trying to create an invisible frame, subscribe it to a few events and print those events when they fire.

Addon.toc

Code:
## Interface: 90200
## Title: |cff93E9BEAddon Title
## Version: 0.1
## Author: cosmic_kid
## SavedVariables: CKNdb
## DefaultState: enabled

Addon.lua
Addon.lua

Lua Code:
  1. local AddonParent = CreateFrame("Frame")
  2.  
  3. print("HELLOOOOOOOO") -- This prints
  4.  
  5. local OnLoad = function(self)
  6.     print("ONLOAD") -- This does not print
  7.     self:RegisterEvent("PLAYER_LOGIN")
  8.     self:RegisterEvent("PLAYER_ENTERING_WORLD")
  9.     self:RegisterEvent("ARENA_OPPONENT_UPDATE")
  10. end
  11.  
  12. local OnEvent = function(self, event, ...)
  13.     print(event) -- This does not print
  14. end
  15.  
  16. AddonParent:SetScript("OnEvent", OnEvent)
  17. AddonParent:SetScript("OnLoad", OnLoad)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Frame:SetScript() Not Working?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off