Mercurial Hosting > luan
comparison core/src/luan/impl/TableExpr.java @ 221:ec016471c6eb
make LuanTable an interface
git-svn-id: https://luan-java.googlecode.com/svn/trunk@222 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 17 Jul 2014 07:49:26 +0000 |
parents | 3dcb0f9bee82 |
children | 23b99a5039b5 |
comparison
equal
deleted
inserted
replaced
220:61afe2a1ce96 | 221:ec016471c6eb |
---|---|
1 package luan.impl; | 1 package luan.impl; |
2 | 2 |
3 import luan.LuanException; | 3 import luan.LuanException; |
4 import luan.LuanTable; | 4 import luan.LuanTable; |
5 import luan.LuanSource; | 5 import luan.LuanSource; |
6 import luan.Luan; | |
6 | 7 |
7 | 8 |
8 final class TableExpr extends CodeImpl implements Expr { | 9 final class TableExpr extends CodeImpl implements Expr { |
9 | 10 |
10 static class Field { | 11 static class Field { |
25 this.fields = fields; | 26 this.fields = fields; |
26 this.expressions = expressions; | 27 this.expressions = expressions; |
27 } | 28 } |
28 | 29 |
29 @Override public Object eval(LuanStateImpl luan) throws LuanException { | 30 @Override public Object eval(LuanStateImpl luan) throws LuanException { |
30 LuanTable table = new LuanTable(); | 31 LuanTable table = Luan.newTable(); |
31 for( Field field : fields ) { | 32 for( Field field : fields ) { |
32 table.put( field.key.eval(luan), field.value.eval(luan) ); | 33 table.put( field.key.eval(luan), field.value.eval(luan) ); |
33 } | 34 } |
34 Object obj = expressions.eval(luan); | 35 Object obj = expressions.eval(luan); |
35 if( obj instanceof Object[] ) { | 36 if( obj instanceof Object[] ) { |