duktaped 1.0.0

duktape high level bindings


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

d-duktape

High level duktape D bindings.

Quick start with dub

"dependencies": {
	"duktaped": "*"
}

Documentation

$ dub build --build=ddox
$ firefox docs/index.html

Example

/**
    Duktape exemples.
*/
import duktape;
import std.stdio;


enum Direction { up, down, left, right }

static void print(string msg)
{
    writeln(msg);
}

class Person
{
private:
    Direction[] _moveHistory;

public:
    this() { }


    void move(Direction dir)
    {
        _moveHistory ~= dir;
    }

    @property Direction[] moveHistory()
    {
        return _moveHistory;
    }
}

int main()
{
    auto ctx = new DukContext();

    ctx.registerGlobal!print;

    ctx.createNamespace("Game")
        .register!Direction
        .register!Person
        .finalize();

    ctx.evalString(q"{
        p = new Game.Person();

        p.move(Game.Direction.up);
        p.move(Game.Direction.down);
        p.move(Game.Direction.left);
        p.move(Game.Direction.right);

        print(p.moveHistory().toString());
    }");

    return 0;
}
Authors:
  • Eliott Dumeix
Dependencies:
none
Versions:
1.0.0 2018-Oct-31
~master 2020-Nov-11
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 25 downloads total

Score:
0.7
Short URL:
duktaped.dub.pm