[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Mixing different versions of Lua
- From: Reuben Thomas <rrt@...>
- Date: Sat, 26 Feb 2011 18:51:25 +0000
On 26 February 2011 18:41, David Manura <dm.lua@math2.org> wrote:
> On Sat, Feb 26, 2011 at 12:15 PM, Reuben Thomas <rrt@sc3d.org> wrote:
>> it looks as though it is easily possible to write
>> scripts that work in both 5.1 and 5.2, and probably quite feasible to
>> write scripts that work in 5.0-5.2.[...]
>> I was wondering whether this multi-version support is common-place, [...]
>
> LuaCOM had some compatibility macros that allowed it to compile under
> 4.0 and 5.0. However, this is now largely removed, and only 5.1 and
> 5.2 are now supported. Some compatibility macros for deprecated
> features are provided with standard Lua as well (LUA_COMPAT_ALL).
>
> Targeting both 5.1 and 5.2 require a few wrappers or code adjustments
> dealing with things like environments and LUA_GLOBALSINDEX, but it's
> quite doable. I've even built 5.1 and 5.2 into the same binary (with
> e.g. "#define lua_newthread lua52_newthread" to avoid symbol clashes).
>
> A page has been dedicated to this topic:
>
> http://lua-users.org/wiki/LuaVersionCompatibility
Thanks. I've found an easy solution which is to change the behaviour
when you supply only one version number. Previously the first set the
minimum, and the second set the maximum; if the second was omitted it
was set to 1000; now it's set to minimum+1 which has the effect of
requiring exactly the "minimum" version. So,
AX_PROG_LUA(501)
does what you'd hope, and requires Lua 5.1.
--
http://rrt.sc3d.org