Add __tostring metamethods to prototypes

This is nice to have, and aids with debugging and interactive usage.
This commit is contained in:
Adrian Perez de Castro
2016-06-23 04:07:01 +03:00
parent ec288bf9fd
commit 56a57f2e89
3 changed files with 25 additions and 0 deletions

View File

@@ -18,8 +18,13 @@ local CqHttpClient = {
quote = function (self, text) return encodeURI(text) end,
unquote = function (self, text) return decodeURI(text) end,
}
CqHttpClient.__name = "matrix.factory.chttp"
CqHttpClient.__index = CqHttpClient
function CqHttpClient:__tostring()
return self.__name
end
local function headers_to_dict(h)
local headers = {}