Package org.luaj.vm2

Examples of org.luaj.vm2.Varargs


      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


  public static LuaTable onCCWrappedILuaObject(final LuaTable table, final ILuaObject object) {
    if(object instanceof CCCommandWrapper) {
      LuaTable lpTable = new LPLuaTable((CCCommandWrapper)object);
      LuaValue k = LuaValue.NIL;
      while(true) {
        Varargs n = table.next(k);
        if((k = n.arg1()).isnil()) break;
        LuaValue v = n.arg(2);
        lpTable.set(k, v);
      }
      ((CCCommandWrapper)object).table = lpTable;
      return lpTable;
    }
View Full Code Here

                Position pos = new Position(entityTable.get("position").get(1).checkint(), entityTable.get("position").get(2).checkint());
                int colour = entityTable.get("colour").checkint();
                boolean collidable = entityTable.get("collidable").checkboolean();

                Entity ent = level.createEntity(a.toString(), new Entity(pos, chr, colour, collidable));
                Varargs entTable = LuaLevel.this.luaEntityTable(a.toString(), ent);

                final String[] events = new String[]{"behavior", "onEntityCollision"};

                for (String ev : events) {
                    if (entityTable.get(ev) != NIL) {
View Full Code Here

        }
    }

    public boolean isCollidable() {
        if (collideFunc != null) {
            Varargs retval = collideFunc.invoke();
            if (!retval.arg1().isboolean()) {
                return true; // make user set a default?
            }
            return retval.arg1().checkboolean();
        }
        return collidable;
    }
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

         * @param $ns           string|int Namespace
         * @param $text         string Title text
         * @param $fragment     string URI fragment
         * @param $interwiki    string Interwiki code
         */
        return new LibFunction() {
            @Override
            public Varargs invoke(Varargs args) {
                LuaValue ns    = args.arg(1);
                LuaValue title = args.arg(2);
                LuaValue fragment = args.arg(3);
View Full Code Here

        }
        return frame;
    }

    private LuaValue getFrameTitle() {
        return new OneArgFunction() {
            @Override
            public LuaValue call(LuaValue arg) {
                return valueOf("getFrameTitleNotImplemented");
            }
        };
View Full Code Here

            }
        };
    }

    private LuaValue getAllExpandedArguments() {
        return new OneArgFunction() {
            @Override public LuaValue call(LuaValue frameId) {
                return getFrameById(frameId).getAllArguments();
            }
        };
    }
View Full Code Here

            }
        };
    }

    private LuaValue frameExists() {
        return new OneArgFunction() {
            @Override
            public LuaValue call(LuaValue arg) {
                // logger.debug("frameExists(" + arg + ")");
                return TRUE;
            }
View Full Code Here

            }
        };
    }

    private OneArgFunction loadPackage() {
        return new OneArgFunction() {
            @Override
            public LuaValue call(LuaValue arg) {
                String name = arg.tojstring();

                InputStream is = loadLocally(name);
View Full Code Here

TOP

Related Classes of org.luaj.vm2.Varargs

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.