net.websocket.frames: Throw an error if no bit lib is found
authorKim Alvefur <zash@zash.se>
Tue, 6 Oct 2015 14:26:23 +0000 (16:26 +0200)
committerKim Alvefur <zash@zash.se>
Tue, 6 Oct 2015 14:26:23 +0000 (16:26 +0200)
net/websocket/frames.lua

index 23f1843776c007666671d38cfb4bf61e0e76ee7c..2ff30736482909652caddeab5b91544a66837284 100644 (file)
@@ -10,8 +10,8 @@ local softreq = require "util.dependencies".softreq;
 local log = require "util.logger".init "websocket.frames";
 local random_bytes = require "util.random".bytes;
 
-local bit = softreq"bit" or softreq"bit32";
-if not bit then 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",
+       "No bit module found. Either LuaJIT 2, lua-bitop or Lua 5.2 is required");
 local band = bit.band;
 local bor = bit.bor;
 local bxor = bit.bxor;