DukContext.register

Automatic registration of D function. (not global)

  1. DukContext register()
    class DukContext
    register
    (
    alias Func
    )
    (
    )
    if (
    isFunction!Func
    )
  2. DukContext register()
  3. DukContext register()

Examples

1 static int square(int n) { return n*n; }
2 
3 auto ctx = new DukContext();
4 ctx.register!square.setGlobal("square"); // equivalent to ctx.registerGlobal!square
5 assert(ctx.evalString!int(r"a = square(5)") == 25);

Meta