Files
flatbuffers-bigfoot/lua/flatbuffers/compat_5_1.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

22 lines
447 B
Lua

local m = {}
local ok, bit = pcall(require, "bit32")
assert(ok, "The Bit32 library must be installed")
assert(pcall(require, "compat53"), "The Compat 5.3 library must be installed")
m.GetAlignSize = function(k, size)
return bit.band(bit.bnot(k) + 1,(size - 1))
end
if not table.unpack then
table.unpack = unpack
end
if not table.pack then
table.pack = pack
end
m.string_pack = string.pack
m.string_unpack = string.unpack
return m