cc-mek-scada/lockbox/util/bit.lua

20 lines
309 B
Lua
Raw Permalink Normal View History

2023-06-11 18:26:55 +00:00
-- modified (simplified) for ComputerCraft
local ok, e = nil, nil
2022-05-29 19:05:57 +00:00
if not ok then
ok, e = pcall(require, "bit32") -- Lua 5.2
end
2023-06-11 18:26:55 +00:00
2022-05-29 19:05:57 +00:00
if not ok then
2023-06-11 18:26:55 +00:00
ok, e = pcall(require, "bit")
2022-05-29 19:05:57 +00:00
end
2023-06-11 18:26:55 +00:00
2022-05-29 19:05:57 +00:00
if not ok then
error("no bitwise support found", 2)
end
2023-06-11 18:26:55 +00:00
assert(type(e) == "table", "invalid bit module")
2022-05-29 19:05:57 +00:00
return e