lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi lua-l,

https://github.com/jeremyong/Selene

This is a followup to the previous Selene announcement. Selene is a C++11-friendly set of bindings designed to be simple and intuitive. There were a number of substantial improvements made since then. The biggest ones are

------------------------
1. Convenient selector syntax

sel::State state;
std::string result = state["foo"][3](5, 4);

This calls a function in the 3 index of table "foo" that takes two arguments and returns a string.

2. Binding classes

struct Foo {
    int x;
    Foo(int x_) : x(x_) {}
    void Double() { x = x * 2; }
    int Get() { return x; }
};

sel::State state;
state["Foo"].SetClass<Foo, int>("double", &Foo::Double, "get", &Foo::Get);

Now in lua, you can do something like

foo = Foo.new(5)
foo:double()
print(foo:get()) -- will print 10 to the console

-------------------------

As before, this code is still prerelease and subject to change. Feel free to use github's issue tracker to report any bugs or suggestions.

Cheers,
Jeremy