comparison core/src/luan/impl/FnCall.java @ 419:8fbb961aabd5

improve repr() to check metamethod recursively
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 30 Apr 2015 23:15:40 -0600
parents d55e873e1f0d
children b48cfa14ba60
comparison
equal deleted inserted replaced
418:455784e2227d 419:8fbb961aabd5
27 if( o instanceof LuanFunction ) { 27 if( o instanceof LuanFunction ) {
28 LuanFunction fn = (LuanFunction)o; 28 LuanFunction fn = (LuanFunction)o;
29 return luan.bit(se).call( fn, fnName, Luan.array(args.eval(luan)) ); 29 return luan.bit(se).call( fn, fnName, Luan.array(args.eval(luan)) );
30 } 30 }
31 if( o instanceof LuanTable ) { 31 if( o instanceof LuanTable ) {
32 Object h = luan.getHandler("__call",(LuanTable)o); 32 LuanTable t = (LuanTable)o;
33 Object h = t.getHandler("__call");
33 if( h != null ) 34 if( h != null )
34 return call(luan,h); 35 return call(luan,h);
35 } 36 }
36 throw luan.bit(fnExpr.se()).exception( "attempt to call '"+fnExpr.se().text()+"' (a " + Luan.type(o) + " value)" ); 37 throw luan.bit(fnExpr.se()).exception( "attempt to call '"+fnExpr.se().text()+"' (a " + Luan.type(o) + " value)" );
37 } 38 }