comparison DependencyLoader/Addon.lua @ 12:b230b94d4487

fixed Addon.lua to use the unhooked EnableAddOn (still needs to be changed to grab from the interface) improved the error message when creating an Addon object on a Blizzard addon (will add direct support later) implemented the hooks on EnableAddOn and LoadAddOn rearranged functions inside Tree.lua, with some edits copied OptDeps from main module to the bootstrap module, to delegate loading to the client when possible
author mckenziemc
date Fri, 10 Dec 2010 00:21:17 -0800
parents e0a4a8b5b389
children a46bf694050c
comparison
equal deleted inserted replaced
11:47d15fc9208e 12:b230b94d4487
8 -- TODO: test if the API functions are quicker with indexes than names. 8 -- TODO: test if the API functions are quicker with indexes than names.
9 -- TODO: modify the dependency stuff to check the Errata module. 9 -- TODO: modify the dependency stuff to check the Errata module.
10 10
11 local Addon, addon = addonTable:NewClass("Addon") 11 local Addon, addon = addonTable:NewClass("Addon")
12 12
13 Addon.enableAddon = EnableAddOn -- TODO: use raw hook from main module?
13 14
14 Addon.addons = {} 15 Addon.addons = {}
15 Addon.nameToIndex = {} 16 Addon.nameToIndex = {}
16 17
17 18
39 40
40 if index then 41 if index then
41 instance.name = GetAddOnInfo(id) 42 instance.name = GetAddOnInfo(id)
42 instance.index = index 43 instance.index = index
43 else 44 else
44 error("Addon not found") 45 local message = "Addon not found: "..(id or "nil")
46 error(message)
45 end 47 end
46 end 48 end
47 49
48 return instance 50 return instance
49 end 51 end
164 end 166 end
165 167
166 168
167 function addon:Enable() 169 function addon:Enable()
168 -- FIXME: delay this till after PLAYER_LOGIN or it'll get force-loaded 170 -- FIXME: delay this till after PLAYER_LOGIN or it'll get force-loaded
169 EnableAddOn(self.name) 171 Addon.enableAddon(self.name)
170 end 172 end
171 173
172 174
173 -- NOTE: only call for LoD, not force-loading 175 -- NOTE: only call for LoD, not force-loading
174 function addon:Load() 176 function addon:Load()