Changeset

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
parents 172:1a32e9ae79d0
children 175:4d2a5d02fdfa
files init.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
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