comparison core/src/luan/impl/IndexExpr.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 7fd9f1b7b878
children b31d614343e8
comparison
equal deleted inserted replaced
418:455784e2227d 419:8fbb961aabd5
25 if( obj instanceof LuanTable ) { 25 if( obj instanceof LuanTable ) {
26 LuanTable tbl = (LuanTable)obj; 26 LuanTable tbl = (LuanTable)obj;
27 Object value = tbl.get(key); 27 Object value = tbl.get(key);
28 if( value != null ) 28 if( value != null )
29 return value; 29 return value;
30 Object h = luan.getHandler("__index",tbl); 30 Object h = tbl.getHandler("__index");
31 if( h==null ) 31 if( h==null )
32 return null; 32 return null;
33 if( h instanceof LuanFunction ) { 33 if( h instanceof LuanFunction ) {
34 LuanFunction fn = (LuanFunction)h; 34 LuanFunction fn = (LuanFunction)h;
35 return Luan.first(luan.bit(se).call(fn,"__index",new Object[]{tbl,key})); 35 return Luan.first(luan.bit(se).call(fn,"__index",new Object[]{tbl,key}));