# HG changeset patch # User Matthew Wild # Date 1261458608 0 # Node ID d1a9fb6495c6b17d7d3b5396977f8cc070969a05 # Parent 6b31cc678fd739683c47364ece6359157dcaad4f Don't allow loading the same plugin more than once diff -r 6b31cc678fd7 -r d1a9fb6495c6 init.lua --- a/init.lua Tue Dec 22 05:06:29 2009 +0000 +++ b/init.lua Tue Dec 22 05:10:08 2009 +0000 @@ -11,7 +11,7 @@ if not stream then error("riddim.new(): Verse stream required as first parameter", 2); end - return setmetatable({ stream = stream, config = config or {} }, riddim_mt); + return setmetatable({ stream = stream, config = config or {}, plugins = {} }, riddim_mt); end -- self.conn is ready for stanzas @@ -75,8 +75,10 @@ end function riddim_mt:add_plugin(name) - require("riddim.plugins."..name); - return riddim.plugins[name](self); + if not self.plugins[name] then + self.plugins[name] = require("riddim.plugins."..name); + return riddim.plugins[name](self); + end end -- Built-in bot starter