Mercurial Hosting > luan
comparison src/luan/interp/TableExpr.java @ 11:b7d7069fee58
add assignment statement and CmdLine
git-svn-id: https://luan-java.googlecode.com/svn/trunk@12 21e917c8-12df-6dd8-5cb6-c86387c605b9
| author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
|---|---|
| date | Thu, 22 Nov 2012 10:51:56 +0000 |
| parents | 24fd6381caca |
| children | 0e406bd9ac7b |
comparison
equal
deleted
inserted
replaced
| 10:8217d8485715 | 11:b7d7069fee58 |
|---|---|
| 3 import luan.LuaException; | 3 import luan.LuaException; |
| 4 import luan.LuaState; | 4 import luan.LuaState; |
| 5 import luan.LuaTable; | 5 import luan.LuaTable; |
| 6 | 6 |
| 7 | 7 |
| 8 final class TableExpr extends Expr { | 8 final class TableExpr implements Expr { |
| 9 | 9 |
| 10 static class Field { | 10 static class Field { |
| 11 final Expr key; | 11 final Expr key; |
| 12 final Expr value; | 12 final Expr value; |
| 13 | 13 |
| 21 | 21 |
| 22 TableExpr(Field[] fields) { | 22 TableExpr(Field[] fields) { |
| 23 this.fields = fields; | 23 this.fields = fields; |
| 24 } | 24 } |
| 25 | 25 |
| 26 @Override Object eval(LuaState lua) throws LuaException { | 26 @Override public Object eval(LuaState lua) throws LuaException { |
| 27 LuaTable table = new LuaTable(); | 27 LuaTable table = new LuaTable(); |
| 28 for( Field field : fields ) { | 28 for( Field field : fields ) { |
| 29 table.set( field.key.eval(lua), field.value.eval(lua) ); | 29 table.set( field.key.eval(lua), field.value.eval(lua) ); |
| 30 } | 30 } |
| 31 return table; | 31 return table; |
