Package org.luaj.vm2

Examples of org.luaj.vm2.LuaValue$None


    public Varargs invoke(Varargs args) {
      LuaList list = new LuaList(instance, new ArrayList<LuaValue>());
     
      if (args.istable(2)) {
        LuaTable table = args.checktable(2);
        LuaValue k = LuaValue.NIL;
       
        while (true) {
           Varargs n = table.next(k);
          
           if ((k = n.arg1()).isnil())
             break;

           LuaValue v = n.arg(2);
           list.append(v);
         }
      }       
      return LuaValue.varargsOf(new LuaValue[] {list});
    }
View Full Code Here


    public Varargs invoke(Varargs args) {
      LuaMap map = new LuaMap(instance, new HashMap<LuaValue,LuaValue>());
     
      if (args.istable(2)) {
        LuaTable table = args.checktable(2);
        LuaValue k = LuaValue.NIL;
       
        while (true) {
           Varargs n = table.next(k);
          
           if ((k = n.arg1()).isnil())
             break;

           LuaValue v = n.arg(2);
           map.put(k, v);
         }
      }       
      return LuaValue.varargsOf(new LuaValue[] {map});
    }
View Full Code Here

      readBytes(nameSize);
      String name = Buffer.utf8ToString(dataBuffer, 0, nameSize);
 
      int particleBytesSize = (int) (opSize - (4 + nameSize));
      readBytes(particleBytesSize);
      LuaValue aggregateValue = instance.getValue(particleType, dataBuffer, 0, particleBytesSize);
           
      if (! name.equals("SUCCESS")) {
        throw new AerospikeException("Query aggregate expected bin name SUCCESS.  Received " + name);
      }
     
View Full Code Here

        else {
          throw new AerospikeException(ResultCode.QUERY_GENERIC, "Query aggregate expected bin name SUCCESS.  Received " + name);
        }
      }
     
      LuaValue aggregateValue = instance.getLuaValue(particleType, dataBuffer, 0, particleBytesSize);
                 
      if (! valid) {
        throw new AerospikeException.QueryTerminated();
      }
View Full Code Here

  public LuaMap getLuaMap(Map<?,?> map) {
    Map<LuaValue,LuaValue> luaMap = new HashMap<LuaValue,LuaValue>(map.size());
   
    for (Map.Entry<?,?> entry : map.entrySet()) {
      LuaValue key = getLuaValue(entry.getKey());
      LuaValue value = getLuaValue(entry.getValue());
      luaMap.put(key, value);
    }
    return new LuaMap(this, luaMap);   
  }
View Full Code Here

    public Varargs invoke(Varargs args) {
      LuaList list = new LuaList(instance, new ArrayList<LuaValue>());
     
      if (args.istable(2)) {
        LuaTable table = args.checktable(2);
        LuaValue k = LuaValue.NIL;
       
        while (true) {
           Varargs n = table.next(k);
          
           if ((k = n.arg1()).isnil())
             break;

           LuaValue v = n.arg(2);
           list.append(v);
         }
      }       
      return LuaValue.varargsOf(new LuaValue[] {list});
    }
View Full Code Here

    public Varargs invoke(Varargs args) {
      LuaMap map = new LuaMap(instance, new HashMap<LuaValue,LuaValue>());
     
      if (args.istable(2)) {
        LuaTable table = args.checktable(2);
        LuaValue k = LuaValue.NIL;
       
        while (true) {
           Varargs n = table.next(k);
          
           if ((k = n.arg1()).isnil())
             break;

           LuaValue v = n.arg(2);
           map.put(k, v);
         }
      }       
      return LuaValue.varargsOf(new LuaValue[] {map});
    }
View Full Code Here

    _G = JsePlatform.standardGlobals();
  }
 
  public void testJavaIntToLuaInt() {
    Integer i = Integer.valueOf(777);
    LuaValue v = CoerceJavaToLua.coerce(i);
    assertEquals( LuaInteger.class, v.getClass() );
    assertEquals( 777, v.toint() );
  }
View Full Code Here

    assertEquals( new Integer(777), o );
  }
 
  public void testJavaStringToLuaString() {
    String s = new String("777");
    LuaValue v = CoerceJavaToLua.coerce(s);
    assertEquals( LuaString.class, v.getClass() );
    assertEquals( "777", v.toString() );
  }
View Full Code Here

    assertEquals( "777", o );
  }
 
  public void testJavaIntArrayToLuaTable() {
    int[] i = { 222, 333 };
    LuaValue v = CoerceJavaToLua.coerce(i);
    assertEquals( JavaArray.class, v.getClass() );
    assertEquals( LuaInteger.valueOf(222), v.get(ONE) );
    assertEquals( LuaInteger.valueOf(333), v.get(TWO) );
    assertEquals( TWO, v.get(LENGTH));
    assertEquals( LuaValue.NIL, v.get(THREE) );
    assertEquals( LuaValue.NIL, v.get(ZERO) );
    v.set(ONE, LuaInteger.valueOf(444));
    v.set(TWO, LuaInteger.valueOf(555));
    assertEquals( 444, i[0] );
    assertEquals( 555, i[1] );
    assertEquals( LuaInteger.valueOf(444), v.get(ONE) );
    assertEquals( LuaInteger.valueOf(555), v.get(TWO) );
    try {
      v.set(ZERO, LuaInteger.valueOf(777));
      fail( "array bound exception not thrown" );
    } catch ( LuaError lee ) {
      // expected
    }
    try {
      v.set(THREE, LuaInteger.valueOf(777));
      fail( "array bound exception not thrown" );
    } catch ( LuaError lee ) {
      // expected
    }
  }
View Full Code Here

TOP

Related Classes of org.luaj.vm2.LuaValue$None

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.