aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-18 13:33:19 +0200
committerKim Alvefur <zash@zash.se>2018-10-18 13:33:19 +0200
commit9a2b621fda3f357c1ac9fff28dd82cd429887b77 (patch)
treec64225d1beb30845c35c079a93feb190c7c30d33 /util
parent0797659ff4ffd0bba384996e11d9900df5b3416c (diff)
downloadprosody-9a2b621fda3f357c1ac9fff28dd82cd429887b77.tar.gz
prosody-9a2b621fda3f357c1ac9fff28dd82cd429887b77.zip
util.promise: Add a string representation
Diffstat (limited to 'util')
-rw-r--r--util/promise.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/promise.lua b/util/promise.lua
index 8b57c822..b5660488 100644
--- a/util/promise.lua
+++ b/util/promise.lua
@@ -1,6 +1,10 @@
local promise_methods = {};
local promise_mt = { __name = "promise", __index = promise_methods };
+function promise_mt:__tostring()
+ return "promise (" .. (self._state or "invalid") .. ")";
+end
+
local function is_promise(o)
local mt = getmetatable(o);
return mt == promise_mt;