changeset 4946:fa415cd9eeca

mod_onions: Fix for bitop with Lua 5.4
author moparisthebest <admin@moparisthebest.com>
date Fri, 20 May 2022 08:41:45 -0400
parents 9d65eb3fcb15
children cc14bfec209b
files mod_onions/mod_onions.lua
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_onions/mod_onions.lua	Fri May 20 08:39:17 2022 -0400
+++ b/mod_onions/mod_onions.lua	Fri May 20 08:41:45 2022 -0400
@@ -10,10 +10,7 @@
 
 local softreq = require "util.dependencies".softreq;
 
-local bit;
-pcall(function() bit = require"bit"; end);
-bit = bit or softreq"bit32"
-if not bit then module:log("error", "No bit module found. Either LuaJIT 2, lua-bitop or Lua 5.2 is required"); end
+local bit = assert(softreq "bit" or softreq "bit32" or softreq "util.bitcompat", "No bit module found. See https://prosody.im/doc/depends#bitop");
 
 local band = bit.band;
 local rshift = bit.rshift;