Changeset

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
parents 904:7648ee2d59d1
children 906:62434bed2873
files mod_websocket/mod_websocket.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
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;