lua-users home
lua-l archive

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


On 1 April 2013 12:03, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2013/4/1 Gary V. Vaughan <gary@vaughan.pe>:
>
>> On 1 Apr 2013, at 16:15, marbux <marbux@gmail.com> wrote:
>>> On Mon, Apr 1, 2013 at 1:50 AM, Gary V. Vaughan <gary@vaughan.pe> wrote:
>>>> I am happy to announce the release of Stdlib 34.1,
>>>> General Lua Libraries.
>>>
>>> Hi, Gary,
>>>
>>> Is Stdlib 34.1 compatible with Lua 5.2?
>>
>> Yes it is :)
>
> I have both Lua 5.1 and 5.2 on my system. "luarocks install stdlib"
> installs stdlib for 5.1. What must I do to install it for 5.2?

That depends on how you configured LuaRocks. The code of LuaRocks
itself runs as both Lua 5.1 and 5.2.

For simplicity, you can either have two separate installations of it,
in different prefixes (passing --prefix, --with-lua-version and so on
to the configure script). Beware of mixing the local ~/.luarocks tree,
though.

Or, you can write a separate config.lua file containing your Lua 5.2
paths (includes, etc) *and* launch luarocks with your Lua 5.2
interpreter. You could write a `luarocks-5.2` launcher shell-script
like this (untested):

```
#!/bin/sh
LUAROCKS_CONFIG=/etc/luarocks/config-5.2.lua lua-5.2 `which luarocks` "$@"
```

where /etc/luarocks/config-5.2.lua would contain something like:

```
rocks_trees = {
   home.."/.luarocks-5.2/",
   "/usr/local/lib/.luarocks-5.2/",
}
variables = {
   LUA_BINDIR="/usr/local/bin", -- where your lua 5.2 interpreter is located
   LUA_INCDIR="/usr/local/include/lua-5.2/", -- where your lua.h for
Lua 5.2 is located
   LUA_LIBDIR="/usr/local/lib", -- where your liblua.so.5.2 is located
}
```

So, in short, its possible to have LuaRocks drive two versions of Lua
simultaneously, but it's not automatic. It could probably be made more
automatic in future releases.

-- Hisham
http://hisham.hm/