From 90856a67fa2fa8061254006974b8921b4e97bc1a Mon Sep 17 00:00:00 2001 From: rebecca Date: Sat, 12 Sep 2026 18:58:49 +0100 Subject: more oop refactoring --- channel.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'channel.lua') 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 -- cgit v1.2.3