summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-09-25 17:00:01 +0100
committerrebecca <ubq323@ubq323.website>2026-09-25 17:00:50 +0100
commitdbf2436f133ffeb6ac08f1b55d7f9c60edd4b683 (patch)
tree231c50a1703e31ee9231952d8ab3b1bb2e1a8896
parent28a876fa341174e8d17640fc215854328ce65b42 (diff)
add optional busses param to add_channels_for; look at pylon.channels
-rw-r--r--main.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.lua b/main.lua
index c06651f..3e47b13 100644
--- a/main.lua
+++ b/main.lua
@@ -46,11 +46,14 @@ function Wilson.make(cls, conf)
return self
end
-function Wilson.add_channels_for(self, pylon)
+function Wilson.add_channels_for(self, pylon, busses)
if not pylon.channels then return end
- for busname, bus in pairs(self.busses) do
+ busses = busses or self.busses
+ for busname, bus in pairs(busses) do
for _, channel in ipairs(bus) do
- if channel.pylon == pylon then
+ if channel.pylon == pylon
+ and not pylon.channels[channel.id]
+ then
pylon:add_channel(channel)
end end end end