View Single Post
09-03-11, 04:59 AM   #35
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
This is a life saver if you want to make some sense out of your addons.

EG. say you do the same thing in all your addons. Simply put it in a separate file and hey presto all your addons can use the same functionality without you copying and pasting chunks of code. You can even go one further and have a special folder for common files that are shared between your addons and you wouldn't even have to copy and paste the file into your individual addon folders.

Since this feature came out each next update to my addons incorporated this functionality where it was possible as a quick change. I think i still have a large addon that I haven't done this with yet.

Originally Posted by Rilgamon View Post
not sure if I understand you right but you can share data between different files this way:

Code:
local addonName, addonTable = ...
Every file should have a line like this at it's top. Every file loaded in your loading process gets this information passed at startup. First argument is the name of your addon and the second is a table that is passed on to every file. It's empty at first but you can put your data and functions into this table in one file and use them in the next.

So you can split your addon in as many files as you want.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote