Files
flatbuffers/lua/flatbuffers/compat.lua
Derek Bailey 82aed82b84 Added support for Lua 5.1, 5.2 and 5.4 (#6606)
This adds basic support for different Lua versions.

For Lua 5.2 and Lua 5.3, both the Bit32 and Compat53 Lua modules must be
installed for it to work. You can typically get these on Linux using

apt install lua-compat53 lua-bit32

For Lua 5.4, it should work as is, as it is a clean superset of Lua 5.3,
which is what the original Lua Flatbuffers supported.
2021-05-05 16:36:49 -07:00

15 lines
603 B
Lua

local compats = {
["Lua 5.1"] = function()
-- Check if Lua JIT is installed first
local ok = pcall(require, "jit")
if not ok then
return require("flatbuffers.compat_5_1")
else
return require("flatbuffers.compat_luajit")
end
end,
["Lua 5.2"] = function() return require("flatbuffers.compat_5_1") end,
["Lua 5.3"] = function() return require("flatbuffers.compat_5_3") end,
["Lua 5.4"] = function() return require("flatbuffers.compat_5_3") end,
}
return assert(compats[_VERSION], "Unsupported Lua Version: ".._VERSION)()