Lua Version Compatibility |
|
* Bytecode: Lua 5.1 and Lua 5.2.0-alpha are not bytecode compatible, and LuaJit 2.x doesn't support bytecodes. Even within a single version of Lua (5.1), bytecode on different platforms (e.g. Intel x86, Intel x86-64, and PPC) may not be compatible. Source code is more compatible, and source code can be minified (e.g. see squish: CompressionAndArchiving). This typically affects C modules that bundle compiled bytecode (e.g. via BinToCee) and has affected MetaLua. |
* Bytecode: Lua 5.1 and Lua 5.2.0-alpha are not bytecode compatible, and LuaJit 2.x doesn't support the standard Lua interpreter's bytecodes. Even within a single version of Lua (5.1), bytecode on different platforms (e.g. Intel x86, Intel x86-64, and PPC) may not be compatible. Source code is more compatible, and source code can be minified (e.g. see squish: CompressionAndArchiving). This typically affects C modules that bundle compiled bytecode (e.g. via BinToCee) and has affected MetaLua. |
Op) come with different built-in bit libraries, which are compatible to only some extent (e.g. signedness/overflow). Lua Bit
Op can be installed on 5.2, and see also [bit32 for Lua 5.1?]. [lua-bit-numberlua] provides a bit library with Lua 5.2 "bit32" and Lua
Bit
Op "bit" compatibility interfaces.
load
, loadfile
, getfenv
, and setfenv
for use in 5.1 and 5.2
_ENV
in Lua 5.1.
_VERSION
contains the Lua version string (e.g. "Lua 5.1" [2] or "Lua 5.2" [3]. (Note: LuaJit 2.0-beta reports the Lua version as 5.1.) LuaFiveTwo contains new library functions: [lua_version] and [luaL_checkversion]. In C code, lua.h of Lua 5.1 contains these defines:
#define LUA_VERSION "Lua 5.1" #define LUA_RELEASE "Lua 5.1.4" #define LUA_VERSION_NUM 501
_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).