Changeset

4641:2b3ee52fba32

modulemanager: Make module_has_method and module_call_method use rawget()
author Matthew Wild <mwild1@gmail.com>
date Sat, 21 Apr 2012 20:04:07 +0100
parents 4640:645c93eaf249
children 4642:c1602c07d14d
files core/modulemanager.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Sat Apr 21 20:02:45 2012 +0100
+++ b/core/modulemanager.lua	Sat Apr 21 20:04:07 2012 +0100
@@ -261,12 +261,12 @@
 end
 
 function module_has_method(module, method)
-	return type(module.module[method]) == "function";
+	return type(rawget(module.module, method)) == "function";
 end
 
 function call_module_method(module, method, ...)
-	if module_has_method(module, method) then
-		local f = module.module[method];
+	local f = rawget(module.module, method);
+	if type(f) == "function" then
 		return pcall(f, ...);
 	else
 		return false, "no-such-method";