Examples of LuaTable


Examples of org.luaj.vm2.LuaTable

  public LuaStreamLib(LuaInstance instance) {
    this.instance = instance;
  }
 
  public LuaValue call(LuaValue env) {
    LuaTable meta = new LuaTable(0,1);
    meta.set("__tostring", new tostring());
   
    LuaTable table = new LuaTable(0,10);
    table.setmetatable(meta);
    table.set("read", new read());
    table.set("readable", new readable());
    table.set("writeable", new writeable());
    table.set("write", new write());
   
    instance.registerPackage("stream", table);
    return table;
  }
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    this.instance = instance;
    instance.load(new MetaLib(instance));
  }

  public LuaValue call(LuaValue env) {
    LuaTable meta = new LuaTable(0,2);
    meta.set("__call", new create(instance));
   
    LuaTable table = new LuaTable(0,10);
    table.setmetatable(meta);
    table.set("size", new len());
    table.set("set_size", new set_size());
   
    new getint(table, 0, "get_int16");
    new getint(table, 1, "get_int32");
    new getint(table, 2, "get_int64");

    new setint(table, 0, "set_int16");
    new setint(table, 1, "set_int32");
    new setint(table, 2, "set_int64");
   
    table.set("set_string", new set_string());
    table.set("set_bytes", new set_bytes());

    table.set("get_type", new get_type());
    table.set("set_type", new set_type());

    instance.registerPackage("bytes", table);
    return table;
  }
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    public MetaLib(LuaInstance instance) {
      this.instance = instance;
    }

    public LuaValue call(LuaValue env) {
      LuaTable meta = new LuaTable(0, 5);
      meta.set("__len", new len());
      meta.set("__tostring", new tostring());
      meta.set("__index", new index());
      meta.set("__newindex", new newindex());
     
      instance.registerPackage("Bytes", meta);
      return meta;
    }
View Full Code Here

Examples of org.luaj.vm2.LuaTable

  public LuaAerospikeLib(LuaInstance instance) {
    this.instance = instance;
  }

  public LuaValue call(LuaValue env) {   
    LuaTable meta = new LuaTable();
    meta.set("__index", new index());
   
    LuaTable table = new LuaTable();   
    table.setmetatable(meta);
   
    instance.registerPackage("aerospike", table);   
    return table;
  }
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    globals.load(new JseIoLib());
    globals.load(new JseOsLib());
    globals.load(new LuajavaLib());
    globals.load(new DebugLib());
   
    LuaTable packageTable = (LuaTable)globals.get("package");
    loadedTable = (LuaTable)packageTable.get("loaded");
   
    globals.load(new LuaBytesLib(this));
    globals.load(new LuaListLib(this));
    globals.load(new LuaMapLib(this));
    globals.load(new LuaStreamLib(this));   
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    this.instance = instance;
    instance.load(new MetaLib(instance));
  }

  public LuaValue call(LuaValue env) {
    LuaTable meta = new LuaTable(0,2);
    meta.set("__call", new create(instance));
   
    LuaTable table = new LuaTable(0,8);
    table.setmetatable(meta);
    table.set("size", new len());
    table.set("iterator", new iterator());
    table.set("append", new append());
    table.set("prepend", new prepend());
    table.set("take", new take());
    table.set("drop", new drop());
    // list.clone is defined in as.lua
    // table.set("clone", new clone());
   
    instance.registerPackage("list", table);
    return table;
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    public MetaLib(LuaInstance instance) {
      this.instance = instance;
    }

    public LuaValue call(LuaValue env) {
      LuaTable meta = new LuaTable(0, 5);
      meta.set("__len", new len());
      meta.set("__tostring", new tostring());
      meta.set("__index", new index());
      meta.set("__newindex", new newindex());
     
      instance.registerPackage("List", meta);
      return meta;
    }
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    @Override
    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);
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    this.instance = instance;
    instance.load(new MetaLib(instance));
  }

  public LuaValue call(LuaValue env) {
    LuaTable meta = new LuaTable(0,2);
    meta.set("__call", new create(instance));
   
    LuaTable table = new LuaTable(0,8);
    table.setmetatable(meta);
    table.set("size", new len());
    table.set("pairs", new iterator());
    table.set("keys", new keys());
    table.set("values", new values());
    // map.clone and map.merge are defined in as.lua.
    //table.set("clone", new clone());
    //table.set("merge", new merge());
   
    instance.registerPackage("map", table);
View Full Code Here

Examples of org.luaj.vm2.LuaTable

    public MetaLib(LuaInstance instance) {
      this.instance = instance;
    }

    public LuaValue call(LuaValue env) {
      LuaTable meta = new LuaTable(0,5);
      meta.set("__len", new len());
      meta.set("__tostring", new tostring());
      meta.set("__index", new index());
      meta.set("__newindex", new newindex());
     
      instance.registerPackage("Map", meta);
      return meta;
    }     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.