It is possible to install rocks into a directory under the current directory, using the --tree
flag:
luarocks install --tree ./lua_modules lpeg
And then you have to configure your package.path
and package.cpath
variables in Lua (settable via LUA_PATH
and LUA_CPATH
environment variables) so it finds the modules installed inside it. There are several ways to do this conveniently: this tutorial explains how to do it, with more examples.