From dd2f749996583ed2aba09906d83541718f4c8ecf Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 18 Oct 2018 13:33:19 +0200 Subject: util.promise: Add a string representation --- util/promise.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util') 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; -- cgit v1.2.3