Package org.luaj.vm2.lib

Examples of org.luaj.vm2.lib.TwoArgFunction


  public void testIndexFunction() {
    final LuaTable t = new_Table();
    final LuaTable mt = new_Table();   
   
    final TwoArgFunction fb = new TwoArgFunction() {
      public LuaValue call(LuaValue tbl, LuaValue key) {
        assertEquals(tbl, t);
        return valueOf("from mt: "+key);
      }
    };
View Full Code Here


//     assertEquals( abc, string.get(1) );
    assertEquals( abc, function.get(1) );
    assertEquals( abc, thread.get(1) );
   
    // plain metatable
    mt.set( LuaValue.INDEX, new TwoArgFunction() {
      public LuaValue call(LuaValue arg1, LuaValue arg2) {
        return LuaValue.valueOf( arg1.typename()+"["+arg2.tojstring()+"]=xyz" );
      }
     
    });
View Full Code Here

    }
  }
 
  // ----------------- sort support -----------------------------
  public void sort(final LuaValue comparator) {
    super.sort( new TwoArgFunction() {
      public LuaValue call(LuaValue arg1, LuaValue arg2) {
        return comparator.call( arg1.strongvalue(), arg2.strongvalue() );
      }
    } );
  }
View Full Code Here

        tc.set("setlevelstatus", new setlevelstatus());
        tc.set("resetlevelstatus", new resetlevelstatus());
        tc.set("setbackground", new setbackground());
        tc.set("validateAtLeastXObjects", new validateAtLeastXObjects());
        tc.set("validateExactlyXManyObjects", new validateExactlyXManyObjects());
        tc.set("maze", new TwoArgFunction() {

            @Override
            public LuaValue call(LuaValue lv, LuaValue lv1) {
                return mazeToLuaTable(Prim.createMaze(lv.checkint(), lv1.checkint()));
            }
View Full Code Here

    private boolean input = true;
    public Runnable phoneCallback;

    public LevelManager() {
        this.globals = JsePlatform.standardGlobals();
        this.globals.get("math").set("rand", new TwoArgFunction() {

            @Override
            public LuaValue call(LuaValue arg1, LuaValue arg2) {
                int min = arg1.toint();
                int max = arg2.toint();
View Full Code Here

    private void fakeWikiBase() {
        // fake http://www.mediawiki.org/wiki/Extension:Wikibase
        final LuaValue mw = globals.get("mw");
        final LuaTable wikibase = new LuaTable();
        wikibase.set("getEntity", new ZeroArgFunction() {
            @Override public LuaValue call() {
                return NIL;
            }
        });
        mw.set("wikibase", wikibase);
View Full Code Here

            }
        };
    }

    private LuaValue isSubsting() {
        return new ZeroArgFunction() {
            @Override public LuaValue call() {
                // TODO
                return FALSE;
            }
        };
View Full Code Here

            }
        };
    }

    private LuaValue incrementExpensiveFunctionCount() {
        return new ZeroArgFunction() {
            @Override public LuaValue call() {
                if (++expensiveFunctionCount > MAX_EXPENSIVE_CALLS) {
                    error("too many expensive function calls");
                }
                return NIL;
View Full Code Here

            }
        };
    }

    private LuaValue getContLangCode() {
        return new ZeroArgFunction() {
            @Override
            public LuaValue call() {
                return valueOf("en");
            }
        };
View Full Code Here

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

    private LuaValue getEntityTable() {
        return new ZeroArgFunction() {
            @Override
            public LuaValue call() {
                return NIL;
            }
        };
View Full Code Here

TOP

Related Classes of org.luaj.vm2.lib.TwoArgFunction

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.