You can certainly do this (and this is not so!), Although this is not trivial. The Lua core is built for implementation, so you can simply include Lua sources in your own project, and it "just works" :).
The deal is slightly different from the modules - not many of them are suitable for direct embedding. For example, this has been successfully tested for LuaSocket before and here . The main idea is to embed the MODULE sources in your project and insert the luaopen_MODULE function in package.preload['MODULE'] so that require can pick it up later.
One way is to look at the sources of projects that are already implementing Lua and other libraries such as LรVE , MurgaLua and Scrupp .
If the goal of not having one executable file without external libraries is impossible, you can get a little loose and go to a portable application - an application that carries all its dependencies with it in the same directory, regardless of the system. This is what LuaDist was designed for - you use it like LuaRocks to install Lua packages. The difference is that these packages can be installed / deployed in a separate directory, where all the necessary dependencies are also installed. This directory ("dist") is completely independent, that is, you can move it to another location, and it will work anyway.
Also, I donโt like the idea of โโan application that needs to be installed (since it puts files all over my system) - deleting should just be deleting the directory :)
Michal kottman
source share