View Single Post
04/05/14, 01:55 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
1. Unless you need to access this function from another file, make it local.
Lua Code:
  1. local function BBS_Initialize()

2. Only put your function name in the event handler. You want a reference for what to call when the event fires. Not what the function actually returns (which is, in this case, nil).

3. You need to tell the EVENT_MANAGER what is registering for this event. So the first argument is going to be a unique string for your addon. (The alternative is to register the event directly on a frame/control in your addon and skipping the event manager completely.)

4. EVENT_ADD_ON_LOADED fires for every addon that loads. You want to run your code if it's only your addon. Not 10 times for each addon that loads. Use either of the below.
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent(EVENT_ADD_ON_LOADED, function(event, addon
  2.      if addon == "MyAddonName" then
  3.           BBS_Initialize()
  4.      end
  5. end)
[highlight="Lua"]local function BBS_Initialize(event, addon)
if addon == "MyAddonName" then[
--do all the things
end
end/highlight]

4. You created an edit box, but you did not give it a height or say how it should look or anything else. As I mentioned above, I used a template so I didn't have to create it from scratch.


/edit: re-read these two parts of the Addon Quick Questions section of the wiki:
http://wiki.esoui.com/AddOn_Quick_Qu...events_work.3F
http://wiki.esoui.com/AddOn_Quick_Qu...s_or_labels.3F
  Reply With Quote