comparison core/src/luan/LuanTable.java @ 578:60c549d43988

remove LuanState.exception()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Jul 2015 17:40:48 -0600
parents 7c3ad6db8ac3
children cdc70de628b5
comparison
equal deleted inserted replaced
577:d7a85fbe15f1 578:60c549d43988
158 if( h instanceof LuanTable ) { 158 if( h instanceof LuanTable ) {
159 LuanTable tbl = (LuanTable)h; 159 LuanTable tbl = (LuanTable)h;
160 tbl.put(luan,key,value); 160 tbl.put(luan,key,value);
161 return; 161 return;
162 } 162 }
163 throw luan.exception("invalid type "+Luan.type(h)+" for metamethod __new_index"); 163 throw new LuanException(luan,"invalid type "+Luan.type(h)+" for metamethod __new_index");
164 } 164 }
165 165
166 public void rawPut(Object key,Object val) { 166 public void rawPut(Object key,Object val) {
167 Integer iT = Luan.asInteger(key); 167 Integer iT = Luan.asInteger(key);
168 if( iT != null ) { 168 if( iT != null ) {
317 if( h != null ) { 317 if( h != null ) {
318 if( h instanceof LuanFunction ) { 318 if( h instanceof LuanFunction ) {
319 LuanFunction fn = (LuanFunction)h; 319 LuanFunction fn = (LuanFunction)h;
320 Object obj = Luan.first(fn.call(luan,new Object[]{this})); 320 Object obj = Luan.first(fn.call(luan,new Object[]{this}));
321 if( !(obj instanceof LuanFunction) ) 321 if( !(obj instanceof LuanFunction) )
322 throw luan.exception( "metamethod __pairs should return function but returned " + Luan.type(obj) ); 322 throw new LuanException(luan, "metamethod __pairs should return function but returned " + Luan.type(obj) );
323 return (LuanFunction)obj; 323 return (LuanFunction)obj;
324 } 324 }
325 if( h instanceof LuanMeta ) { 325 if( h instanceof LuanMeta ) {
326 LuanMeta meta = (LuanMeta)h; 326 LuanMeta meta = (LuanMeta)h;
327 return meta.__pairs(luan,this); 327 return meta.__pairs(luan,this);
328 } 328 }
329 throw luan.exception( "invalid type of metamethod __pairs: " + Luan.type(h) ); 329 throw new LuanException(luan, "invalid type of metamethod __pairs: " + Luan.type(h) );
330 } 330 }
331 return rawPairs(); 331 return rawPairs();
332 } 332 }
333 333
334 private LuanFunction rawPairs() { 334 private LuanFunction rawPairs() {