private static Object toJava(LuaValue luajValue) { switch (luajValue.type()) { case LuaValue.TNIL: return null; case LuaValue.TSTRING: return luajValue.tojstring(); case LuaValue.TUSERDATA: return luajValue.checkuserdata(Object.class); case LuaValue.TNUMBER: return luajValue.isinttype() ? (Object) new Integer(luajValue.toint()) : (Object) new Double(luajValue.todouble()); default: return luajValue; } }