View Single Post
02-16-12, 10:09 AM   #7
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,362
Before I (or someone else) comments on the code first things first.

It's best if you get a few things out of the way surrounding development before going into the actual lua.

1. Do not package the whole Ace3 framework with your addon.
Libraries (where needed) are meant to be embedded in your addon folder (simplest case)
For example if you need AceTimer-3.0 a typical folder structure would be.
BlushResponse\Libs\AceTimer-3.0\AceTimer-3.0.xml (and other files contained in the library folder)
BlushResponse\Libs\LibStub\LibStub.lua
BlushResponse\Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml (and other files)
Your .toc file references files relative to the addon folder so BlushResponse is the 'root' folder where the .toc is concerned.
.toc
Code:
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceTimer-3.0\AceTimer-3.0\AceTimer-3.0.xml
BlushResponse.lua
would be the corresponding .toc entries with the structure demonstrated above.

2. Get rid of the .xml file, as long as you're creating the frames in lua (there is equivalent API allowing you to create frames, set scripts etc without using xml)

3. If you're just getting started with addon writing and since this addon is relatively simple in scope I'd suggest you stay away from frameworks for your first project.
Libraries simplify common or repetitive tasks but they're only a time saver when the need to use them has arisen 'naturally' as you find yourself writing your Nth command handler, options table etc.
For an author just beginning, the overhead of an additional layer of API over the base wow lua API is probably going to be more confusion than help.

Will get back to you with some code snippets but any author contributing is unlikely to fix your existing code, more likely re-write it

Edit: Forgot
4. Make sure you have an error display addon installed (!BugGrabber + BugSack are a good option)
or at the least the in-game option to "Show Lua Errors" (under game preferences -> Help) enabled.
World of Warcraft\Logs\FrameXML.log might also hold error information about your addon.

Last edited by Dridzt : 02-16-12 at 10:19 AM.
  Reply With Quote