diff core/src/luan/impl/FnCall.java @ 404:d55e873e1f0d

metatables now only apply to tables
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 29 Apr 2015 07:04:40 -0600
parents 3dcb0f9bee82
children 8fbb961aabd5
line wrap: on
line diff
--- a/core/src/luan/impl/FnCall.java	Tue Apr 28 22:49:33 2015 -0600
+++ b/core/src/luan/impl/FnCall.java	Wed Apr 29 07:04:40 2015 -0600
@@ -4,6 +4,7 @@
 import luan.LuanFunction;
 import luan.LuanException;
 import luan.LuanSource;
+import luan.LuanTable;
 
 
 final class FnCall extends CodeImpl implements Expressions {
@@ -27,9 +28,11 @@
 			LuanFunction fn = (LuanFunction)o;
 			return luan.bit(se).call( fn, fnName, Luan.array(args.eval(luan)) );
 		}
-		Object h = luan.getHandler("__call",o);
-		if( h != null )
-			return call(luan,h);
+		if( o instanceof LuanTable ) {
+			Object h = luan.getHandler("__call",(LuanTable)o);
+			if( h != null )
+				return call(luan,h);
+		}
 		throw luan.bit(fnExpr.se()).exception( "attempt to call '"+fnExpr.se().text()+"' (a " + Luan.type(o) + " value)" );
 	}