init.lua

changeset 3
d1a9fb6495c6
parent 2
6b31cc678fd7
child 5
d9ed6e7d9936
--- 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

mercurial