lua-users home
lua-l archive

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


> For the longest time, I use -DLUA_COMPAT_ALL in that script's CPPFLAGS, for maximum compatibility across Lua releases.

LUA_COMPAT_ALL was introduced in Lua 5.2.0, three years ago, not so long ago...
However, the name LUA_COMPAT_ALL encompass too much and is not very precise.
So we changed it in 5.3 to be precise about which version we want compatibility.

> for Lua 5.3.0rc3 I have to use different flags (-DLUA_COMPAT_5_2, others?).

Define LUA_COMPAT_5_2 for compatibility with Lua 5.2.
Define LUA_COMPAT_5_1 for compatibility with Lua 5.1.

The Makefile explicitly defines LUA_COMPAT_5_2 and not LUA_COMPAT_5_1,
so all 5.2 features are turned on by default and all 5.1 features are
turned off by default.

The 5.2 features that are controlled by LUA_COMPAT_5_2 are deprecated.

For new projects, we recommend that LUA_COMPAT_5_2 is left undefined
to help migration. Individual 5.2 features can be turned on by
defining these:

#define LUA_COMPAT_MATHLIB
#define LUA_COMPAT_BITLIB
#define LUA_COMPAT_IPAIRS
#define LUA_COMPAT_APIINTCASTS

As you can see, not much.

For details, see luaconf.h.