Comparison

net/websocket/frames.lua @ 6896:c11776f85552

net.websocket.frames: Throw an error if no bit lib is found
author Kim Alvefur <zash@zash.se>
date Tue, 06 Oct 2015 16:26:23 +0200
parent 6895:f04fadabd5d9
child 6897:8972b1a96526
comparison
equal deleted inserted replaced
6895:f04fadabd5d9 6896:c11776f85552
8 8
9 local softreq = require "util.dependencies".softreq; 9 local softreq = require "util.dependencies".softreq;
10 local log = require "util.logger".init "websocket.frames"; 10 local log = require "util.logger".init "websocket.frames";
11 local random_bytes = require "util.random".bytes; 11 local random_bytes = require "util.random".bytes;
12 12
13 local bit = softreq"bit" or softreq"bit32"; 13 local bit = assert(softreq"bit" or softreq"bit32",
14 if not bit then log("error", "No bit module found. Either LuaJIT 2, lua-bitop or Lua 5.2 is required"); end 14 "No bit module found. Either LuaJIT 2, lua-bitop or Lua 5.2 is required");
15 local band = bit.band; 15 local band = bit.band;
16 local bor = bit.bor; 16 local bor = bit.bor;
17 local bxor = bit.bxor; 17 local bxor = bit.bxor;
18 local lshift = bit.lshift; 18 local lshift = bit.lshift;
19 local rshift = bit.rshift; 19 local rshift = bit.rshift;