DukContext.register

Automatic registration of D class. (not global)

  1. DukContext register()
  2. DukContext register()
  3. DukContext register()
    class DukContext
    register
    (
    alias Class
    )
    (
    )
    if (
    is(Class == class)
    )

Examples

// Point is a class that hold x, y coordinates
auto ctx = new DukContext();
ctx.register!Point.setGlobal("Point"); // equivalent to ctx.registerGlobal!Point
assert(ctx.evalString!string(r"new Point(1, 2).toString()") == "(1, 2)");

Meta