I\'ve embedded lua together with a bytecode chunk into a project written in C. Now when I extend my lua code base by adding .lua files, is there a way to keep this code in a sin
Another alternative is to use a tool like Mathew Wild's squish to collect all your Lua sources into a single .lua file. One nice feature of squish is that it supports a variety of filters to help make the squished package smaller than the total of the source files.
After applying squish, you could run the result through luac to get bytecode. However, bytecode is often larger than the source code, and almost certainly larger if a more aggressive filter (such as gzip) is used in squish.
If your bytecode file were stored separately from the executable (or worse, transmitted over the network), I'd also bring up security concerns related to bytecode that don't apply to Lua source code. However, bytecode linked in to an application is much harder to subvert since harmful bytecode will never be the result of running luac.