Package org.luaj.vm2.compiler

Examples of org.luaj.vm2.compiler.FuncState


        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

   
    final static String LUADIR = "lua";
   
    public static boolean init () {
    String script = LUADIR + "\\sv_init.lua";
        LuaValue _G = JsePlatform.standardGlobals();
        try {
            _G.get("dofile").call(LuaValue.valueOf(script));
           
        } catch (org.luaj.vm2.LuaError ex) {
            Main.ui.commitln("Error: " + ex.getMessage());
            Main.ui.commitln(sutil.ADVICE.REINSTALL.s());
            return true;
View Full Code Here

                }

                Vector<SpriteAnimationDirection> directions = new Vector<SpriteAnimationDirection>();

                // 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();
                    int originX = directionTable.get("origin_x").optint(0);
                    int originY = directionTable.get("origin_y").optint(0);
                    int numFrames = directionTable.get("num_frames").optint(1);
                    int numColumns = directionTable.get("num_columns").optint(numFrames);

                    Rectangle firstFrameRectangle = new Rectangle(x, y, frameWidth, frameHeight);

                    try {
                      SpriteAnimationDirection direction =  new SpriteAnimationDirection(
View Full Code Here

        params.put("b", "b_value");
        subject = new Frame(params, null);
    }

    @Test public void testGetAllArguments() {
        LuaValue arguments = subject.getAllArguments();
        assertThat(arguments.length()).isEqualTo(2);
        assertThat(arguments.get(1).toString()).isEqualTo("a_value");
        assertThat(arguments.get(2).toString()).isEqualTo("b_value");
    }
View Full Code Here

TOP

Related Classes of org.luaj.vm2.compiler.FuncState

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.