Is there something like python's virtualenv in lua?
So I can install all required lua modules/rocks in a sandboxed environment. This is good for test, since I will not mess up with system-wide lua modules or another lua project's environment.
luarocks looks promising since its support of self-contained installation. But I'm interested that if there is some tool like virtualenv which automates the creation, maintenance and switch of sandboxed environments.
It should be fairly simple to switch between Lua installs by setting the LUA_PATH
environment variable. Quoting this page from the Lua documentation:
To determine its path, require first checks the global variable LUA_PATH. If the value of LUA_PATH is a string, that string is the path. Otherwise, require checks the environment variable LUA_PATH.
[...]
The components in a path are separated by semicolons (a character seldom used for file names in most operating systems). For instance, if the path is
?;?.lua;c:\windows\?;/usr/local/lua/?/?.lua
then the call require"lili" will try to open the following files:
lili
lili.lua
c:\windows\lili
/usr/local/lua/lili/lili.lua