Diff

core/modulemanager.lua @ 713:2afd6d9e21cd

modulemanager: Check for syntax errors before reloading a module
author Waqas Hussain <waqas20@gmail.com>
date Tue, 13 Jan 2009 23:16:39 +0500
parent 710:56f6c115bc69
child 733:b1aedec00661
line wrap: on
line diff
--- a/core/modulemanager.lua	Tue Jan 13 22:39:07 2009 +0500
+++ b/core/modulemanager.lua	Tue Jan 13 23:16:39 2009 +0500
@@ -164,6 +164,12 @@
 	local mod = modulemap[host] and modulemap[host][name];
 	if not mod then return nil, "module-not-loaded"; end
 
+	local _mod, err = loadfile(plugin_dir.."mod_"..name..".lua"); -- checking for syntax errors
+	if not _mod then
+		log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
+		return nil, err;
+	end
+
 	local saved;
 	if type(mod.module.save) == "function" then
 		local ok, err = pcall(mod.module.save)