Package org.luaj.vm2

Examples of org.luaj.vm2.LuaClosure


        return "mw.html";
    }

    @Override
    public LuaTable getInterface() {
        LuaTable iface = new LuaTable();
        return iface;

    }
View Full Code Here


        return "mw.title";
    }

    @Override
    public LuaTable getInterface() {
        LuaTable table = new LuaTable();
        table.set("newTitle", newTitle());
        table.set("makeTitle", makeTitle());
        table.set("getUrl", getUrl());
        table.set("getContent", getContent());
        table.set("fileExists", fileExists());
        table.set("protectionLevels", defaultFunction());
        return table;
    }
View Full Code Here

        };
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable table = new LuaTable();
        table.set("thisTitle", title());
        table.set("NS_MEDIA", MEDIA_NAMESPACE_KEY.code);
        return table;
    }
View Full Code Here

            LuaValue.valueOf("fragment"),
            LuaValue.valueOf("interwiki"));
    }

    private LuaValue title(LuaValue ns, LuaValue title, LuaValue fragment, LuaValue interwiki) {
        LuaTable table = new LuaTable();
        table.set("isLocal", "");
        table.set("isRedirect", "");
        table.set("subjectNsText", "");
        table.set("interwiki", interwiki);
        table.set("namespace", LuaValue.valueOf(MAIN_NAMESPACE_KEY.code));
        table.set("nsText", "");
        table.set("text", "");
        table.set("id", title);
        table.set("fragment", fragment);
        table.set("contentModel", "");
        table.set("thePartialUrl", "");
        return table;
    }
View Full Code Here

        return "mw.ustring";
    }

    @Override
    public LuaTable getInterface() {
        return new LuaTable();
    }
View Full Code Here

        return new LuaTable();
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable table = new LuaTable();
        // https://www.mediawiki.org/wiki/Manual:$wgMaxArticleSize
        // stringLengthLimit = $wgMaxArticleSize * 1024;
        table.set("stringLengthLimit"2048 * 1024);
        table.set("patternLengthLimit", 10000);
        return table;
    }
View Full Code Here

        return "mw.site";
    }

    @Override
    public LuaTable getInterface() {
        LuaTable table = new LuaTable();
        table.set("getNsIndex", getNsIndex());
        table.set("pagesInCategory", pagesInCategory());
        table.set("pagesInNamespace", pagesInNamespace());
        table.set("usersInGroup", usersInGroup());
        return table;
    }
View Full Code Here

        };
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable table = new LuaTable();
        table.set("siteName", "test");      // $GLOBALS['wgSitename'],
        table.set("server", "server");      // $GLOBALS['wgServer'],
        table.set("scriptPath", "");        // $GLOBALS['wgScriptPath'],
        table.set("stylePath""");        // $GLOBALS['wgStylePath'],
        table.set("currentVersion", "1.0"); // SpecialVersion::getVersion(),
        table.set("stats", stats());
        table.set("namespaces", namespaces());
        return table;
    }
View Full Code Here

        table.set("namespaces", namespaces());
        return table;
    }

    private LuaTable stats() {
        LuaTable stats = new LuaTable();

        stats.set("pages", 0);        // (int)SiteStats::pages(),
        stats.set("articles", 0);     // (int)SiteStats::articles(),
        stats.set("files", 0);        // (int)SiteStats::images(),
        stats.set("edits", 0);        // (int)SiteStats::edits(),
        stats.set("views", NIL);      // $wgDisableCounters ? null : (int)SiteStats::views(),
        stats.set("users", 0);        // (int)SiteStats::users(),
        stats.set("activeUsers", 0)// (int)SiteStats::activeUsers(),
        stats.set("admins", 0);       // (int)SiteStats::numberingroup( 'sysop' ),
        return stats;
    }
View Full Code Here

        stats.set("admins", 0);       // (int)SiteStats::numberingroup( 'sysop' ),
        return stats;
    }

    private LuaTable namespaces() {
        LuaTable table = new LuaTable();
        for (INamespace.NamespaceCode code : INamespace.NamespaceCode.values()) {
            INamespaceValue namespaceValue = wikiModel.getNamespace().getNamespaceByNumber(code);
            table.set(code.code, luaDataForNamespace(namespaceValue));
        }
        return table;
    }
View Full Code Here

TOP

Related Classes of org.luaj.vm2.LuaClosure

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.