diff options
Diffstat (limited to 'channel.lua')
| -rw-r--r-- | channel.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/channel.lua b/channel.lua index e908069..f921e36 100644 --- a/channel.lua +++ b/channel.lua @@ -1,15 +1,14 @@ +local class = require'r.class' -- channel descriptor -local Channel = {} -function Channel.make(pylon, descriptor) - return setmetatable({pylon=pylon, descriptor=descriptor}, Channel) +local Channel = class() +function Channel.make(cls, pylon, descriptor) + return setmetatable({pylon=pylon, descriptor=descriptor}, cls) end function Channel.__eq(self, other) return self.pylon == other.pylon and self.descriptor == other.descriptor end -function Channel.__call(_, ...) return Channel.make(...) end function Channel.__tostring(self) return self.pylon.name .. ':' .. self.descriptor end -setmetatable(Channel, Channel) return Channel |
