← Back to context

Comment by randrews

15 years ago

I've been thinking about things I could build that would fix that, but that's sort of how we got into this in the first place. :-)

Yeah. The people who are using Lua primarily in an embedded context (and thus have a lot of dependencies, such as threading & graphic libs, already chosen for them) have VERY different priorities than the people using Lua standalone. It pulls the community in two different (and occasionally opposed) directions, and the Lua team doesn't want to alienate either camp.

(On the balance, though, it's still one of my favorites.)

  • Yes, definitely. The problem I'm running into is that the people writing the module systems are thinking in terms of running it standalone.

    I want a way to get a bunch of Lua libraries and cram them into one thing I can easily embed and make available to my embedded Lua interpreter. I can't really visualize how that would work though, so I can't write it yet.

    • 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.

      1 reply →