Mercurial > wow > ouroloot
comparison core.lua @ 63:00bf6d4f9238
Initial support for modules checking minimum requirements.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Fri, 20 Apr 2012 04:14:36 +0000 |
| parents | d5fe3482db67 |
| children | 359d0159d6ca |
comparison
equal
deleted
inserted
replaced
| 62:d5fe3482db67 | 63:00bf6d4f9238 |
|---|---|
| 721 addon:SetDefaultModulePrototype(prototype) | 721 addon:SetDefaultModulePrototype(prototype) |
| 722 -- Fires before the plugin's own OnEnable (inherited or otherwise). | 722 -- Fires before the plugin's own OnEnable (inherited or otherwise). |
| 723 --function addon:OnModuleCreated (plugin) | 723 --function addon:OnModuleCreated (plugin) |
| 724 -- print("created plugin", plugin:GetName()) | 724 -- print("created plugin", plugin:GetName()) |
| 725 --end | 725 --end |
| 726 | |
| 727 local olrev = tonumber("@project-revision@") or 0 | |
| 728 local err = "Module '%s' did not load because it failed a required condition: '%s'" | |
| 729 function addon:ConstrainedNewModule (modname, minrev, mincomm, mindata) | |
| 730 if not addon.author_debug then | |
| 731 if minrev and minrev < olrev then | |
| 732 self:Print(err,modname, | |
| 733 "revision "..olrev.." older than minimum "..minrev) | |
| 734 return false | |
| 735 end | |
| 736 if mincomm and mincomm < tonumber(self.commrev) then | |
| 737 self:Print(err,modname, | |
| 738 "commrev "..self.commrev.." older than minimum "..mincomm) | |
| 739 return false | |
| 740 end | |
| 741 if mindata and mindata < opts.datarev then | |
| 742 self:Print(err,modname, | |
| 743 "datarev "..opts.datarev.." older than minimum "..mindata) | |
| 744 return false | |
| 745 end | |
| 746 end | |
| 747 return self:NewModule(modname) | |
| 748 end | |
| 726 end | 749 end |
| 727 | 750 |
| 728 | 751 |
| 729 ------ Event handlers | 752 ------ Event handlers |
| 730 function addon:_clear_SVs() | 753 function addon:_clear_SVs() |
