Comparison

core/moduleapi.lua @ 4854:dab55c6f7710

moduleapi: Don't auto-reload self when already reloading (fixes reload of modules with cyclic dependencies)
author Matthew Wild <mwild1@gmail.com>
date Fri, 11 May 2012 18:55:23 +0100
parent 4790:8bf710b19f65
child 4893:98ff89ab5d1d
comparison
equal deleted inserted replaced
4853:4ca9328e37d5 4854:dab55c6f7710
110 110
111 function api:depends(name) 111 function api:depends(name)
112 if not self.dependencies then 112 if not self.dependencies then
113 self.dependencies = {}; 113 self.dependencies = {};
114 self:hook("module-reloaded", function (event) 114 self:hook("module-reloaded", function (event)
115 if self.dependencies[event.module] then 115 if self.dependencies[event.module] and not self.reloading then
116 self:log("info", "Auto-reloading due to reload of %s:%s", event.host, event.module); 116 self:log("info", "Auto-reloading due to reload of %s:%s", event.host, event.module);
117 modulemanager.reload(self.host, self.name); 117 modulemanager.reload(self.host, self.name);
118 return; 118 return;
119 end 119 end
120 end); 120 end);