lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 28 January 2016 at 23:10, Luke Drummond <> wrote:
> For those of us familiar with python-virtualenv and wanting similar
> behaviour in the Lua world, I've written a simple shellscript to
> basically emulate this behaviour.

Nice!  This would complete a related project of mine: making it very
easy to just write Lua(JIT) and C code in any form, type 'make' and
have a self-contained executable, ready to be deployed without any
dependencies or complex runtime structure.

currently it's just a single generic Makefile with the needed rules,
and a couple of 'install' targets to create a project directory.  It's
quite neat, and even fast; but it falls short of helping to reuse
existing code.  The obvious answer would be to somehow integrate with
LuaRocks, i.e, make it easy to install any available rocks within the
project and have it compiled in the finished executable.

apart from compilation, i also hacked a very simple 'virtualenv like'
script to make it easy to manage project-specific LUA_PATHs.  I
supposed that would also hint LuaRocks where to install packages; but
it doesn't.

> As Leaf mentions, Lua/LuaRocks
> support this isolation behaviour out of the box, so it's a fairly
> simple set of steps to automate this.

reading the LuaRocks docs (and now Leaf's guide), it seems that it
should be a matter of just specifying the destination address; but I
seems that the user would have to type it each and every time, right?
I was thinking (but didn't try) of using an alias or script that added
this option (maybe pulling from an environment variable, analogous to
LUA_PATH).  But i see your script builds LuaRocks specifically for
each project.