lua-users home
lua-l archive

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

On Sat, Feb 26, 2011 at 12:15 PM, Reuben Thomas <> 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: