diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-18 13:33:19 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-18 13:33:19 +0200 |
commit | 6f0d5898132801206f2304f5a572bdc679167ff5 (patch) | |
tree | c64225d1beb30845c35c079a93feb190c7c30d33 | |
parent | cdd7a0fbf86fad5d905e1fec47fd315ba800f7ea (diff) | |
download | prosody-6f0d5898132801206f2304f5a572bdc679167ff5.tar.gz prosody-6f0d5898132801206f2304f5a572bdc679167ff5.zip |
util.promise: Add a string representation
-rw-r--r-- | util/promise.lua | 4 |
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; |