From eff344483464d1e1de1fda8d32a7fb1998546007 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sat, 4 Nov 2023 12:56:49 -0400 Subject: [PATCH] added type def to ppm and return a copy of the peripherals list rather than the table itself --- scada-common/ppm.lua | 14 +++++++++----- scada-common/util.lua | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scada-common/ppm.lua b/scada-common/ppm.lua index 6af4e2f..d54fec8 100644 --- a/scada-common/ppm.lua +++ b/scada-common/ppm.lua @@ -161,10 +161,10 @@ local function peri_init(iface) setmetatable(self.device, mt) - return { - type = self.type, - dev = self.device - } + ---@class ppm_entry + local entry = { type = self.type, dev = self.device } + + return entry end ---------------------- @@ -310,7 +310,11 @@ function ppm.list_avail() return peripheral.getNames() end -- list mounted peripherals ---@nodiscard ---@return table mounts -function ppm.list_mounts() return ppm_sys.mounts end +function ppm.list_mounts() + local list = {} + for k, v in pairs(ppm_sys.mounts) do list[k] = v end + return list +end -- get a mounted peripheral side/interface by device table ---@nodiscard diff --git a/scada-common/util.lua b/scada-common/util.lua index 01d9adf..1ab8cd7 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -18,7 +18,7 @@ local type = type local util = {} -- scada-common version -util.version = "1.1.6" +util.version = "1.1.7" util.TICK_TIME_S = 0.05 util.TICK_TIME_MS = 50