Changeset

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
parents 999:c088139d8f05
children 1001:4bd375bde3cb
files core/configmanager.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
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;