Comment by silentbicycle
15 years ago
You can compile a set of (Lua) libraries with luac, then insert the bytecode as a string literal in a C program. loadstring works on bytecode, too. With C libraries, link as usual.
There are utilities floating around to reformat the luac.out file (compiler output), but all you really need to do is put
static const char *lua_code = "..."; /* with the body escaped */
If you don't end a line with ;, it will be concatenated to a subsequent string literal at compile time. Oh, and multiple lua files can be compiled into one luac.out.
Does that help? If you have further questions, contact info is in my profile.
That's the core of what I was going to do, but I want to put on top of it something like Bundler, where I can specify which libraries I want (and which ones depend on other ones) and it will build it for me.
Although I think the only one I want is Penlight, so that is probably overkill. :)