diff core.lua @ 49:fd3dd12f96ce

Handle text generation modules being LoadOnDemand. lib-st widget to v5 to fix handling multiple live ST instances.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sun, 29 Jan 2012 03:38:30 +0000
parents 22db12e97313
children 973d7396e0bf
line wrap: on
line diff
--- a/core.lua	Sat Jan 28 23:36:23 2012 +0000
+++ b/core.lua	Sun Jan 29 03:38:30 2012 +0000
@@ -556,6 +556,8 @@
 	end)
 	_G.InterfaceOptions_AddCategory(bliz)
 
+	self:_scan_LOD_modules()
+
 	if self.debug.flow then self:Print"is in control-flow debug mode." end
 end
 --function addon:OnDisable() end
@@ -1103,6 +1105,21 @@
 	end
 end
 
+-- Check for plugins which haven't already been loaded, and add hooks for
+-- them.  Credit to DBM for the approach here.
+function addon:_scan_LOD_modules()
+	for i = 1, GetNumAddOns() do
+		if GetAddOnMetadata (i, "X-OuroLoot-Plugin")
+		   and IsAddOnLoadOnDemand(i)
+		   and not IsAddOnLoaded(i)
+		then
+			local folder, _, _, enabled, _, reason = GetAddOnInfo(i)
+			local tabtitle = GetAddOnMetadata (i, "X-OuroLoot-Plugin")
+			self:_gui_add_LOD_tab (tabtitle, folder, i, enabled, reason)
+		end
+	end
+end
+
 -- Adds indices to traverse the tables in a nice sorted order.
 do
 	local byindex, temp = {}, {}