Diff

init.lua @ 173:3112a9e450ac

verse: Make add_plugin only load a plugin once per stream
author Matthew Wild <mwild1@gmail.com>
date Thu, 30 Dec 2010 22:59:23 +0000
parent 163:48a47bca9a63
child 205:cbcd45be11a8
line wrap: on
line diff
--- a/init.lua	Thu Dec 30 20:19:47 2010 +0000
+++ b/init.lua	Thu Dec 30 22:59:23 2010 +0000
@@ -22,6 +22,7 @@
 	t.id = tostring(t):match("%x*$");
 	t:set_logger(logger, true);
 	t.events = events.new();
+	t.plugins = {};
 	return t;
 end
 
@@ -173,10 +174,12 @@
 end
 
 function stream:add_plugin(name)
+	if self.plugins[name] then return true; end
 	if require("verse.plugins."..name) then
 		local ok, err = verse.plugins[name](self);
 		if ok ~= false then
 			self:debug("Loaded %s plugin", name);
+			self.plugins[name] = true;
 		else
 			self:warn("Failed to load %s plugin: %s", name, err);
 		end