summaryrefslogtreecommitdiff
path: root/channel.lua
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-09-12 18:58:49 +0100
committerrebecca <ubq323@ubq323.website>2026-09-12 18:58:49 +0100
commit90856a67fa2fa8061254006974b8921b4e97bc1a (patch)
treecce28902a826d511b6bd38755c886746fe5cd18e /channel.lua
parent085040f49cc1386b294857aa68651329b0044420 (diff)
more oop refactoring
Diffstat (limited to 'channel.lua')
-rw-r--r--channel.lua9
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