From ebb5c84b7447dbff1e5428f788c0cf44f14d9ce5 Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Sat, 24 Oct 2009 03:36:51 +0000 Subject: [PATCH] Get instance data directly from the stack. --- src/j2se/org/luaj/lib/j2se/LuajavaLib.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/j2se/org/luaj/lib/j2se/LuajavaLib.java b/src/j2se/org/luaj/lib/j2se/LuajavaLib.java index 709ab488..15ea4f39 100644 --- a/src/j2se/org/luaj/lib/j2se/LuajavaLib.java +++ b/src/j2se/org/luaj/lib/j2se/LuajavaLib.java @@ -227,9 +227,8 @@ public final class LuajavaLib extends LFunction { mt = new LTable(); mt.put( LValue.TM_INDEX, new LFunction() { public boolean luaStackCall(LuaState vm) { - LValue table = vm.topointer(2); + Object instance = vm.touserdata(2); LValue key = vm.topointer(3); - Object instance = table.toJavaInstance(); if ( key instanceof LInteger ) { if ( clazz.isArray() ) { vm.resettop(); @@ -261,11 +260,9 @@ public final class LuajavaLib extends LFunction { }); mt.put( LValue.TM_NEWINDEX, new LFunction() { public boolean luaStackCall(LuaState vm) { - LValue table = vm.topointer(2); + Object instance = vm.touserdata(2); LValue key = vm.topointer(3); LValue val = vm.topointer(4); - Object instance = table.toJavaInstance(); - if ( key instanceof LInteger ) { if ( clazz.isArray() ) { vm.resettop();