# HG changeset patch # User Farmbuyer of US-Kilrogg # Date 1334895276 0 # Node ID 00bf6d4f923872c7dadda7cf97cfb262c5514920 # Parent d5fe3482db673f56d9d9a78de6b3ffa2ea8e764a Initial support for modules checking minimum requirements. diff -r d5fe3482db67 -r 00bf6d4f9238 core.lua --- a/core.lua Fri Apr 20 03:29:24 2012 +0000 +++ b/core.lua Fri Apr 20 04:14:36 2012 +0000 @@ -723,6 +723,29 @@ --function addon:OnModuleCreated (plugin) -- print("created plugin", plugin:GetName()) --end + + local olrev = tonumber("@project-revision@") or 0 + local err = "Module '%s' did not load because it failed a required condition: '%s'" + function addon:ConstrainedNewModule (modname, minrev, mincomm, mindata) + if not addon.author_debug then + if minrev and minrev < olrev then + self:Print(err,modname, + "revision "..olrev.." older than minimum "..minrev) + return false + end + if mincomm and mincomm < tonumber(self.commrev) then + self:Print(err,modname, + "commrev "..self.commrev.." older than minimum "..mincomm) + return false + end + if mindata and mindata < opts.datarev then + self:Print(err,modname, + "datarev "..opts.datarev.." older than minimum "..mindata) + return false + end + end + return self:NewModule(modname) + end end