Diff

mod_websocket/mod_websocket.lua @ 905:eae665bc2122

mod_websocket: Fix require to work with lua-bitop (Thanks István and Zash)
author Florian Zeitz <florob@babelmonkeys.de>
date Sun, 10 Feb 2013 20:12:42 +0100
parent 895:1f4d77104da5
child 909:ec4c6e8f277d
line wrap: on
line diff
--- a/mod_websocket/mod_websocket.lua	Mon Feb 04 01:36:41 2013 +0100
+++ b/mod_websocket/mod_websocket.lua	Sun Feb 10 20:12:42 2013 +0100
@@ -13,7 +13,10 @@
 local softreq = require "util.dependencies".softreq;
 local portmanager = require "core.portmanager";
 
-local bit = softreq"bit" or softreq"bit32" or module:log("error", "No bit module found. Either LuaJIT 2 or Lua 5.2 is required");
+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 band = bit.band;
 local bxor = bit.bxor;