Software /
code /
prosody-modules
Comparison
mod_storage_appendmap/mod_storage_appendmap.lua @ 2635:4548c3d685b4
mod_storage_appendmap: Successfully return nothing on ENOENT
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 21 Mar 2017 15:56:43 +0100 |
parent | 2431:623e23190c3e |
child | 2796:6a7b7cb7148e |
comparison
equal
deleted
inserted
replaced
2634:71ce798c86cc | 2635:4548c3d685b4 |
---|---|
14 module:log("debug", "File is %s", filename); | 14 module:log("debug", "File is %s", filename); |
15 local env = {}; | 15 local env = {}; |
16 if _VERSION == "Lua 5.1" then -- HACK | 16 if _VERSION == "Lua 5.1" then -- HACK |
17 env._ENV = env; -- HACK | 17 env._ENV = env; -- HACK |
18 end -- SO MANY HACKS | 18 end -- SO MANY HACKS |
19 local chunk, err = load(filename, env); | 19 local chunk, err, errno = load(filename, env); |
20 if not chunk then return chunk, err; end | 20 if not chunk then if errno == 2 then return end return chunk, err; end |
21 local ok, err = pcall(chunk); | 21 local ok, err = pcall(chunk); |
22 if not ok then return ok, err; end | 22 if not ok then return ok, err; end |
23 if _VERSION == "Lua 5.1" then -- HACK | 23 if _VERSION == "Lua 5.1" then -- HACK |
24 env._ENV = nil; -- HACK | 24 env._ENV = nil; -- HACK |
25 end -- HACKS EVERYWHERE | 25 end -- HACKS EVERYWHERE |