Diff

core/configmanager.lua @ 1000:a73715a9267f

core.configmanager: Fire event when (re)loading config file
author Matthew Wild <mwild1@gmail.com>
date Fri, 17 Apr 2009 16:14:20 +0100
parent 913:3e2dac84017d
child 1504:9d8c35e98ca2
line wrap: on
line diff
--- a/core/configmanager.lua	Fri Apr 17 16:11:11 2009 +0100
+++ b/core/configmanager.lua	Fri Apr 17 16:14:20 2009 +0100
@@ -12,6 +12,8 @@
 local 	setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type = 
 		setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type;
 
+local eventmanager = require "core.eventmanager";
+
 module "configmanager"
 
 local parsers = {};
@@ -68,6 +70,9 @@
 		if f then 
 			local ok, err = parsers[format].load(f:read("*a"));
 			f:close();
+			if ok then
+				eventmanager.fire_event("config-reloaded", { filename = filename, format = format });
+			end
 			return ok, "parser", err;
 		end
 		return f, "file", err;