diff --git a/src/core/org/luaj/vm/LuaState.java b/src/core/org/luaj/vm/LuaState.java index 5948868b..209ade54 100644 --- a/src/core/org/luaj/vm/LuaState.java +++ b/src/core/org/luaj/vm/LuaState.java @@ -578,7 +578,7 @@ public class LuaState extends Lua { val = this.stack[base + a]; table = cl.env; this.top = base + a; - table.luaSetTable(this, table, key, val); + luaV_settable(table, key, val); continue; } case LuaState.OP_SETUPVAL: { @@ -591,7 +591,7 @@ public class LuaState extends Lua { val = GETARG_RKC(k, i); table = this.stack[base + a]; this.top = base + a; - table.luaSetTable(this, table, key, val); + luaV_settable(table, key, val); continue; } case LuaState.OP_NEWTABLE: { @@ -915,8 +915,12 @@ public class LuaState extends Lua { LValue h = mt.get(tag); return h.isNil()? null: h; } + + private void indexError(LValue nontable) { + error( "attempt to index ? (a "+nontable.luaGetTypeName()+" value)", 1 ); + } - private void luaV_gettable(LValue table, LValue key) { + public void luaV_gettable(LValue table, LValue key) { LTable m; LValue v,h=LNil.NIL,t=table; for ( int loop=0; loop */ public void setglobal(String name) { - LTable g = this._G; - LValue v = poplvalue(); - g.luaSetTable(this, g, new LString(name), v); + luaV_settable(_G, new LString(name), poplvalue()); } /** @@ -2098,7 +2133,7 @@ public class LuaState extends Lua { LTable t = totable(index); LValue v = poplvalue(); LValue k = poplvalue(); - t.luaSetTable(this, t, k, v); + luaV_settable(t, k, v); } /**