Mercurial Hosting > luan
comparison src/luan/interp/SetTableEntry.java @ 31:5cf15507d77e
separate interpreter from interface
git-svn-id: https://luan-java.googlecode.com/svn/trunk@32 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 13 Dec 2012 02:50:04 +0000 |
parents | 09d41f7490a8 |
children | e51906de0f11 |
comparison
equal
deleted
inserted
replaced
30:8d8f4f5caef4 | 31:5cf15507d77e |
---|---|
1 package luan.interp; | 1 package luan.interp; |
2 | 2 |
3 import luan.LuaState; | |
4 import luan.LuaException; | 3 import luan.LuaException; |
5 import luan.LuaTable; | 4 import luan.LuaTable; |
6 import luan.Lua; | 5 import luan.Lua; |
7 | 6 |
8 | 7 |
13 SetTableEntry(Expr tableExpr,Expr keyExpr) { | 12 SetTableEntry(Expr tableExpr,Expr keyExpr) { |
14 this.tableExpr = tableExpr; | 13 this.tableExpr = tableExpr; |
15 this.keyExpr = keyExpr; | 14 this.keyExpr = keyExpr; |
16 } | 15 } |
17 | 16 |
18 @Override public void set(LuaState lua,Object value) throws LuaException { | 17 @Override public void set(LuaStateImpl lua,Object value) throws LuaException { |
19 Object t = tableExpr.eval(lua); | 18 Object t = tableExpr.eval(lua); |
20 if( !(t instanceof LuaTable) ) | 19 if( !(t instanceof LuaTable) ) |
21 throw new LuaException( "attempt to index a " + Lua.type(t) + " value" ); | 20 throw new LuaException( "attempt to index a " + Lua.type(t) + " value" ); |
22 LuaTable table = (LuaTable)t; | 21 LuaTable table = (LuaTable)t; |
23 Object key = keyExpr.eval(lua); | 22 Object key = keyExpr.eval(lua); |