LuaBox
Posted 13 hours ago
The other neat thing I'm doing here which is different from my previous DEX stuff is that I've hidden away the ugly, gory details of the module (memory, const char*, etc) behind a nice clean C# interface. That way dealing with pointers is the library's problem, and the game only has to worry about dealing with Lua.
I've also added some basic support to allow you to push your own C# lambdas and functions into the module as C function pointers, which allowed me to dynamically set up the Lua VM with s&box API bindings at runtime through the type library.
That way everything's just hooked up for you automatically and you can use the s&box API the exact same way you would in C#, except it's all completely runtime.
The API's not fully comprehensive yet, notably there still isn't support for arrays or any complex C# stuff like generics etc., but it's enough to fiddle about with and it shows off what's possible.
These bindings are all handwritten at this point, though in the future it's definitely going to make sense to start working on some automatic binding tools. I believe the Emscripten equivalent of this is called embind.