comparison core/src/luan/LuanTable.java @ 509:e3b0846dc2ef

throw exception for invalid indexes of string, binary, or java
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 22 May 2015 02:02:49 -0600
parents 92c3d22745b8
children 2da0bcb979b5
comparison
equal deleted inserted replaced
508:9218f9cf45d3 509:e3b0846dc2ef
129 if( obj instanceof LuanTable ) { 129 if( obj instanceof LuanTable ) {
130 LuanTable tbl = (LuanTable)obj; 130 LuanTable tbl = (LuanTable)obj;
131 return tbl.get(luan,key); 131 return tbl.get(luan,key);
132 } 132 }
133 if( obj instanceof String ) 133 if( obj instanceof String )
134 return StringLuan.__index(luan,(String)obj,key); 134 return StringLuan.__index(bit,(String)obj,key);
135 if( obj instanceof byte[] ) 135 if( obj instanceof byte[] )
136 return BinaryLuan.__index(luan,(byte[])obj,key); 136 return BinaryLuan.__index(bit,(byte[])obj,key);
137 if( obj != null && luan.hasJava() ) 137 if( obj != null && luan.hasJava() )
138 return JavaLuan.__index(luan,obj,key); 138 return JavaLuan.__index(bit,obj,key);
139 else if( bit.el==null ) 139 else if( bit.el==null )
140 throw bit.exception( "attempt to index a " + Luan.type(obj) + " value" ); 140 throw bit.exception( "attempt to index a " + Luan.type(obj) + " value" );
141 else 141 else
142 throw bit.exception( "attempt to index '"+bit.el.text()+"' (a " + Luan.type(obj) + " value)" ); 142 throw bit.exception( "attempt to index '"+bit.el.text()+"' (a " + Luan.type(obj) + " value)" );
143 } 143 }