Package org.luaj.vm2

Examples of org.luaj.vm2.Prototype


    L.nCcalls--;
  }
 
  void pushclosure(FuncState func, expdesc v) {
    FuncState fs = this.fs;
    Prototype f = fs.f;
    if (f.p == null || fs.np + 1 > f.p.length)
      f.p = LuaC.realloc( f.p, fs.np*2 + 1 );
    f.p[fs.np++] = func.f;
    v.init(VRELOCABLE, fs.codeABx(Lua.OP_CLOSURE, 0, fs.np - 1));
    for (int i = 0; i < func.f.nups; i++) {
View Full Code Here


    }
  }
 
  void open_func (FuncState fs) {
      LuaC L = this.L;
      Prototype f = new Prototype();
      if ( this.fs!=null )
        f.source = this.fs.f.source;
      fs.f = f;
      fs.prev = this.fs;  /* linked list of funcstates */
      fs.ls = this;
View Full Code Here

      fs.htable = new Hashtable();
  }

  void close_func() {
    FuncState fs = this.fs;
    Prototype f = fs.f;
    this.removevars(0);
    fs.ret(0, 0); /* final return */
    f.code = LuaC.realloc(f.code, fs.pc);
    f.lineinfo = LuaC.realloc(f.lineinfo, fs.pc);
    // f.sizelineinfo = fs.pc;
View Full Code Here

  /* }====================================================================== */

  void parlist () {
    /* parlist -> [ param { `,' param } ] */
    FuncState fs = this.fs;
    Prototype f = fs.f;
    int nparams = 0;
    f.is_vararg = 0;
    if (this.t.token != ')') {  /* is `parlist' not empty? */
      do {
        switch (this.t.token) {
View Full Code Here

    LuaClosure c = di.closure;
    for (int i = 0, j = what.length(); i < j; i++) {
      switch (what.charAt(i)) {
        case 'S': {
          if ( c != null ) {
            Prototype p = c.p;
            info.set(WHAT, LUA);
            info.set(SOURCE, p.source);
            info.set(SHORT_SRC, valueOf(sourceshort(p)));
            info.set(LINEDEFINED, valueOf(p.linedefined));
            info.set(LASTLINEDEFINED, valueOf(p.lastlinedefined));
View Full Code Here

 
  // return StrValue[] { name, namewhat } if found, null if not
  static LuaString[] getobjname(DebugInfo di, int stackpos) {
    LuaString name;
    if (di.closure != null) { /* a Lua function? */
      Prototype p = di.closure.p;
      int pc = di.pc; // currentpc(L, ci);
      int i;// Instruction i;
      name = p.getlocalname(stackpos + 1, pc);
      if (name != null) /* is a local? */
        return new LuaString[] { name, LOCAL };
      i = symbexec(p, pc, stackpos); /* try symbolic execution */
      lua_assert(pc != -1);
      switch (Lua.GET_OPCODE(i)) {
View Full Code Here

  public void load(String packageName, boolean system) throws AerospikeException {
    if (loadedTable.get(packageName).toboolean()) {
      return;
    }
   
    Prototype prototype = LuaCache.loadPackage(packageName, system);
    LuaClosure function = new LuaClosure(prototype, globals);
    function.invoke();
   
    loadedTable.set(packageName, LuaValue.TRUE);
  }
View Full Code Here

                // Traverse the directions table.
                LuaValue key = LuaValue.NIL;
                while (true) {

                    Varargs keyValue = directionsTable.next(key);
                    key = keyValue.arg1();
                    if (key.isnil()) {
                        break;
                    }
                    LuaValue directionTable = keyValue.arg(2);

                    int x = directionTable.get("x").checkint();
                    int y = directionTable.get("y").checkint();
                    int frameWidth = directionTable.get("frame_width").checkint();
                    int frameHeight = directionTable.get("frame_height").checkint();
View Full Code Here

        final int testCount        = tests.get("count").toint();
        final LuaValue provideFunc = tests.get("provide");
        final LuaValue runFunc     = tests.get("run");

        for (int i=1; i<testCount+1; i++) {
            final Varargs provideValue = provideFunc.invoke(valueOf(i));
            final LuaValue name = provideValue.arg(2);
            final String expected = provideValue.arg(3).checkjstring();

            Description testDescription = Description.createTestDescription(getClass(), name.toString());

            if (isIgnored(testDescription)) {
                notifier.fireTestIgnored(testDescription);
View Full Code Here

        return table;
    }

    private LuaValue getUrl() {

        return new LibFunction() {
            /**
             *  $text, $which, $query = null, $proto = null
             */
            @Override public Varargs invoke(Varargs args) {
                return NIL;
View Full Code Here

TOP

Related Classes of org.luaj.vm2.Prototype

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.