Add __tostring metamethods to prototypes
This is nice to have, and aids with debugging and interactive usage.
This commit is contained in:
@@ -27,6 +27,7 @@ end
|
||||
|
||||
|
||||
local API = {}
|
||||
API.__name = "matrix.api"
|
||||
API.__index = API
|
||||
|
||||
setmetatable(API, { __call = function (self, base_url, token, http_factory)
|
||||
@@ -40,6 +41,10 @@ setmetatable(API, { __call = function (self, base_url, token, http_factory)
|
||||
}, API)
|
||||
end })
|
||||
|
||||
function API:__tostring()
|
||||
return self.__name .. "{" .. self.base_url .. "}"
|
||||
end
|
||||
|
||||
function API:_quote(string)
|
||||
return self._http:quote(string)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user