From 57cc66eba67cfff5a9868d3586fdc1a7d9857335 Mon Sep 17 00:00:00 2001 From: Pablo Mayobre Date: Sun, 8 Feb 2015 07:28:31 -0300 Subject: [PATCH] Checking the libs doesnt error Added pcalls instead of raw requires as suggested by Kikito --- md5.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/md5.lua b/md5.lua index 85753a3..05cafc3 100644 --- a/md5.lua +++ b/md5.lua @@ -35,9 +35,10 @@ local char, byte, format, rep, sub = string.char, string.byte, string.format, string.rep, string.sub local bit_or, bit_and, bit_not, bit_xor, bit_rshift, bit_lshift -if require "bit" or require "bit32" then - local bit = require "bit" or require "bit32" - +local ok, bit = pcall(require, 'bit') +if not ok then ok, bit = pcall(require, 'bit32') end + +if ok then bit_or, bit_and, bit_not, bit_xor = bit.bor, bit.band, bit.bnot, bit.bxor bit_rshift, bit_lshift = bit.rshift, bit.lshift else