Package org.luaj.vm2

Examples of org.luaj.vm2.LuaThread


        return "mw.uri";
    }

    @Override
    public LuaTable getInterface() {
        LuaTable iface = new LuaTable();
        iface.set("anchorEncode", anchorEncode());
        iface.set("localUrl", localUrl());
        iface.set("fullUrl", fullUrl());
        iface.set("canonicalUrl", canonicalUrl());
        return iface;
    }
View Full Code Here


        };
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable options = new LuaTable();
        return options;
    }
View Full Code Here

    private String formatQuery(LuaValue page, LuaValue query) {
        if (query.isstring()) {
            return wgScript + "?title="+page.checkstring()+"&"+query.checkjstring();
        } else if (query.istable()) {
            LuaTable params = query.checktable();

            String base = wgScript + "?title="+page.checkstring()+"&";
            for (LuaValue key : params.keys()) {
                base += (key.tojstring() + "=" + params.get(key).tojstring());
            }
            return base;
        } else {
            throw new AssertionError("unexpected type: "+query);
        }
View Full Code Here

    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

    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

  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

  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

    return NONE;
  }
 
  static Varargs _gethook(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    DebugState ds = getDebugState(thread);
    return varargsOf(
        ds.hookfunc,
        valueOf((ds.hookcall?"c":"")+(ds.hookline?"l":"")+(ds.hookrtrn?"r":"")),
        valueOf(ds.hookcount));
View Full Code Here

        valueOf(ds.hookcount));
  }

  static Varargs _sethook(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    LuaValue func    = args.optfunction(a++, null);
    String str       = args.optjstring(a++,"");
    int count        = args.optint(a++,0);
    boolean call=false,line=false,rtrn=false;
    for ( int i=0; i<str.length(); i++ )
View Full Code Here

    return object;
  }
 
  protected static Varargs _getinfo(Varargs args, LuaValue level0func) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    LuaValue func = args.arg(a++);
    String what = args.optjstring(a++, "nSluf");
   
    // find the stack info
    DebugState ds = getDebugState( thread );
View Full Code Here

TOP

Related Classes of org.luaj.vm2.LuaThread

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.