Lua Version Compatibility

lua-users home
wiki

This page is dedicated to information on ensuring that Lua code remains compatible across multiple versions of Lua (e.g. 5.1 and LuaFiveTwo), as well as different LuaImplementations.


#define LUA_VERSION	"Lua 5.1"

#define LUA_RELEASE	"Lua 5.1.4"

#define LUA_VERSION_NUM	501

There are reasons to prefer capability detection over version detection [5]. Doing tests like _VERSION == "Lua 5.2" will almost certainly break in 5.3. _VERSION ~= "Lua 5.1" will more likely be forward compatible, though will break in 5.0 (if that matters).

RecentChanges · preferences
edit · history
Last edited March 1, 2014 5:44 pm GMT (diff)