Package org.luaj.vm2

Examples of org.luaj.vm2.LuaClosure


                // 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

         * @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

            @Override
            public LuaValue call(LuaValue f, LuaValue env) {
                return f;
            }
        });
        globals.set("gefenv", new OneArgFunction() {
            public LuaValue call(LuaValue f) {
                return globals;
            }
        });
        globals.set("unpack", new unpack());

        // math.log10 got removed in 5.2
        LuaValue math = globals.get("math");
        math.set("log10", new OneArgFunction() {
            @Override
            public LuaValue call(LuaValue luaValue) {
                return valueOf(Math.log10(luaValue.checkdouble()));
            }
        });

        // table.maxn got removed in 5.2
        LuaValue table = globals.get("table");
        table.set("maxn", new OneArgFunction() {
            @Override public LuaValue call(LuaValue arg) {
                // TODO: is this correct?
                return arg.checktable().len();
            }
        });
View Full Code Here

            }
        };
    }

    private LuaValue unstrip() {
        return new OneArgFunction() {
            @Override
            public LuaValue call(LuaValue arg) {
                return NIL;
            }
        };
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.