comparison src/luan/interp/TableExpr.java @ 111:2428ecfed375

change LuanFunction.call() from returning Object[] to returning Object, to reduce garbage collection git-svn-id: https://luan-java.googlecode.com/svn/trunk@112 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 23 May 2014 20:40:05 +0000
parents 8ede219cd111
children
comparison
equal deleted inserted replaced
110:7afa6df829f3 111:2428ecfed375
29 @Override public Object eval(LuanStateImpl luan) throws LuanException { 29 @Override public Object eval(LuanStateImpl luan) throws LuanException {
30 LuanTable table = new LuanTable(); 30 LuanTable table = new LuanTable();
31 for( Field field : fields ) { 31 for( Field field : fields ) {
32 table.put( field.key.eval(luan), field.value.eval(luan) ); 32 table.put( field.key.eval(luan), field.value.eval(luan) );
33 } 33 }
34 Object[] a = expressions.eval(luan); 34 Object obj = expressions.eval(luan);
35 for( int i=0; i<a.length; i++ ) { 35 if( obj instanceof Object[] ) {
36 table.put( i+1, a[i] ); 36 Object[] a = (Object[])obj;
37 for( int i=0; i<a.length; i++ ) {
38 table.put( i+1, a[i] );
39 }
40 } else {
41 table.put( 1, obj );
37 } 42 }
38 return table; 43 return table;
39 } 44 }
40 } 45 }