Mercurial Hosting > luan
view src/luan/interp/TableExpr.java @ 4:24fd6381caca
add to interp
git-svn-id: https://luan-java.googlecode.com/svn/trunk@5 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 18 Nov 2012 04:18:15 +0000 |
parents | |
children | b7d7069fee58 |
line wrap: on
line source
package luan.interp; import luan.LuaException; import luan.LuaState; import luan.LuaTable; final class TableExpr extends Expr { static class Field { final Expr key; final Expr value; Field(Expr key,Expr value) { this.key = key; this.value = value; } } private final Field[] fields; TableExpr(Field[] fields) { this.fields = fields; } @Override Object eval(LuaState lua) throws LuaException { LuaTable table = new LuaTable(); for( Field field : fields ) { table.set( field.key.eval(lua), field.value.eval(lua) ); } return table; } }