comparison core/src/luan/modules/JavaLuan.java @ 426:23a93c118042

fix LuanTable.get() to use metatables
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 01 May 2015 18:44:20 -0600
parents b31d614343e8
children dae264ad6a7b
comparison
equal deleted inserted replaced
425:0a2fb80907f9 426:23a93c118042
321 throws Throwable 321 throws Throwable
322 { 322 {
323 if( args==null ) 323 if( args==null )
324 args = new Object[0]; 324 args = new Object[0];
325 String name = method.getName(); 325 String name = method.getName();
326 Object fnObj = t.get(name); 326 Object fnObj = t.get(luan,name);
327 if( fnObj==null && base!=null ) 327 if( fnObj==null && base!=null )
328 return method.invoke(base,args); 328 return method.invoke(base,args);
329 LuanFunction fn = luan.checkFunction(fnObj); 329 LuanFunction fn = luan.checkFunction(fnObj);
330 return Luan.first(luan.call(fn,name,args)); 330 return Luan.first(luan.call(fn,name,args));
331 } 331 }
463 } 463 }
464 464
465 private static String SECURITY_KEY = "Java.Security"; 465 private static String SECURITY_KEY = "Java.Security";
466 466
467 private static void check(LuanState luan,String name) throws LuanException { 467 private static void check(LuanState luan,String name) throws LuanException {
468 Security s = (Security)luan.registry().get(SECURITY_KEY); 468 Security s = (Security)luan.registry().rawGet(SECURITY_KEY);
469 if( s!=null ) 469 if( s!=null )
470 s.check(luan,name); 470 s.check(luan,name);
471 } 471 }
472 472
473 public static void setSecurity(LuanState luan,Security s) { 473 public static void setSecurity(LuanState luan,Security s) {