… I was just uninformed. Anders has created a fantastic set of the C bindings in D over at Google code: dlua.
The module lua.c is the original C bindings ported to the D Programming Language, changing as little as possible. The module lua.wrap contains an Object-Oriented D wrapper to the C bindings, and allows simple interaction without knowing the C Lua API. Both lua.c and lua.wrap are tango and phobos compatible, and should work on any platform for which D and Lua are available. A simple example:
version (Tango)
import tango.io.Console;
else
import std.stdio : Cout = writef;
extern (C) int testfunction(State L)
{
Cout(”Hello from D!\n”);
return 0;
}
void main()
{
Lua lua = new Lua();
lua.register(&testfunction, “testfunction”);
lua.execute(”testfunction()”);
}
The main() function is the bit to look at. The intention is to have a simple, powerful wrapper for the Lua engine so that D developers can expose scripting functionality in their own code.
I am currently testing out how to add runtime reflection into the wrapper, so you can just register an object and have it operable in the Lua engine, without having to register each member and function.
Popularity: 24%