Mercurial > prosody-hg
comparison util/hashes.lua @ 407:7ae008771391
Fix softreq, so it reports when no suitable MD5 library is found
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 25 Nov 2008 01:56:20 +0000 |
| parents | 4ea1ec218976 |
| children |
comparison
equal
deleted
inserted
replaced
| 406:11f176cae9da | 407:7ae008771391 |
|---|---|
| 1 | 1 |
| 2 local softreq = function (...) return select(2, pcall(require, ...)); end | 2 local softreq = function (...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end |
| 3 local error = error; | 3 local error = error; |
| 4 | 4 |
| 5 module "hashes" | 5 module "hashes" |
| 6 | 6 |
| 7 local md5 = softreq("md5"); | 7 local md5 = softreq("md5"); |
