View Single Post
04-11-20, 10:50 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,917
This is the new go to place for API help for WoW
https://wow.gamepedia.com/World_of_Warcraft_API

I would suggest looking at some small recent addons to see how things are coded now to give you a start and then slowly relearn some of the addon stuff thats still hidden somewhere in your programming memory

What I find useful is to create a template addon so to speak that has the pure basics and then build any specifics into it for any addon I want to write.

For example:
This is a simple addon template that nearly all of my addons have used as their starting point. Feel free to utilise yourself if you want.

Good Luck

Lua Code:
  1. --[[ Localise the Addon Wide Data Table ]]--
  2. local addonName, addonData = ...
  3.  
  4. --[[ Localise any Addon Wide Sub Tables that are frequently accessed ]]--
  5. local Translate = addonData.Translate
  6.  
  7. --[[ Addon Specific Functionality ]]--
  8. ...
  9.  
  10.  
  11. --[[ Monitor registered events ]]--
  12. local function EventWatcher(self,event,...)
  13.     -- Store the arguments into an array to access when needed
  14.     local args = { ... }
  15.  
  16.     if event == "PLAYER_ENTERING_WORLD" then
  17.        -- Deal with player entering world
  18.    elseif event == "ADDON_LOADED" then
  19.       -- Deal with any addons being loaded that you want to watch for ( args[1] is addon being loaded )
  20.     end
  21.  
  22. end
  23.  
  24. local f = CreateFrame("Frame")
  25. f:RegisterEvent("ADDON_LOADED")
  26. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  27. f:SetScript("OnEvent", EventWatcher)
__________________
  Reply With Quote