diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-10-26 19:29:08 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-10-26 19:29:08 +0100 |
commit | f05e8649eddd2180e39ebe9482fee29bf7652c97 (patch) | |
tree | 20620497ffafc592a84e2c9069ee6daa246a8f42 /util | |
parent | 8323ed1e016607112f5640ca667760687737c117 (diff) | |
download | prosody-f05e8649eddd2180e39ebe9482fee29bf7652c97.tar.gz prosody-f05e8649eddd2180e39ebe9482fee29bf7652c97.zip |
util.xpcall, util.compat: Add non-hacky multi-argument xpcall() for Lua 5.1
Diffstat (limited to 'util')
-rw-r--r-- | util/xpcall.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/util/xpcall.lua b/util/xpcall.lua new file mode 100644 index 00000000..d2fc5011 --- /dev/null +++ b/util/xpcall.lua @@ -0,0 +1,9 @@ +local xpcall = xpcall; + +if select(2, xpcall(function (x) return x end, function () end, "test")) ~= "test" then + xpcall = require"util.compat".xpcall; +end + +return { + xpcall = xpcall; +}; |