diff core/src/luan/impl/IndexExpr.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 b48cfa14ba60
line wrap: on
line diff
--- a/core/src/luan/impl/IndexExpr.java	Fri May 01 17:18:23 2015 -0600
+++ b/core/src/luan/impl/IndexExpr.java	Fri May 01 18:44:20 2015 -0600
@@ -24,21 +24,7 @@
 	private Object index(LuanStateImpl luan,Object obj,Object key) throws LuanException {
 		if( obj instanceof LuanTable ) {
 			LuanTable tbl = (LuanTable)obj;
-			Object value = tbl.get(key);
-			if( value != null )
-				return value;
-			Object h = tbl.getHandler("__index");
-			if( h==null )
-				return null;
-			if( h instanceof LuanFunction ) {
-				LuanFunction fn = (LuanFunction)h;
-				return Luan.first(luan.bit(se).call(fn,"__index",new Object[]{tbl,key}));
-			}
-			if( h instanceof LuanMeta ) {
-				LuanMeta meta = (LuanMeta)h;
-				return meta.__index(luan,tbl,key);
-			}
-			return index(luan,h,key);
+			return tbl.get(luan,key);
 		}
 		if( obj instanceof String )
 			return StringLuan.__index(luan,(String)obj,key);