diff core/src/luan/impl/IndexExpr.java @ 421:b31d614343e8

add Io.LuanString.text_writer(); improve java related errors; fix to_string;
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 01 May 2015 15:13:14 -0600
parents 8fbb961aabd5
children 23a93c118042
line wrap: on
line diff
--- a/core/src/luan/impl/IndexExpr.java	Fri May 01 14:23:17 2015 -0600
+++ b/core/src/luan/impl/IndexExpr.java	Fri May 01 15:13:14 2015 -0600
@@ -44,11 +44,9 @@
 			return StringLuan.__index(luan,(String)obj,key);
 		if( obj instanceof byte[] )
 			return BinaryLuan.__index(luan,(byte[])obj,key);
-		if( obj != null ) {
-			Object value = JavaLuan.__index(luan,obj,key);
-			if( value != null )
-				return value;
-		}
-		throw luan.bit(op1.se()).exception( "attempt to index '"+op1.se().text()+"' (a " + Luan.type(obj) + " value)" );
+		if( obj != null && luan.currentEnvironment().hasJava() )
+			return JavaLuan.__index(luan,obj,key);
+		else
+			throw luan.bit(op1.se()).exception( "attempt to index '"+op1.se().text()+"' (a " + Luan.type(obj) + " value)" );
 	}
 }