Thanks to Tim Channon for contributing a patch demonstrating this approach. The definitions of a few short discount functions are copied into ldiscount.c, and changed to write to a luaL_Buffer rather than a file. Hopefully windows support will now be possible (with a few more modifications, Tim has had lua-discount building on several non-MS windows compilers).