diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 15:03:01 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 15:03:01 +0200 |
commit | c18c5b9025435f294decc0c0e817dbf5b41319d9 (patch) | |
tree | 160f114b429e03919649481caaa9386598102c64 | |
parent | 16f35a5690132fc7cde014b8409c66da71485b20 (diff) | |
download | luaatc_envs-c18c5b9025435f294decc0c0e817dbf5b41319d9.tar.gz luaatc_envs-c18c5b9025435f294decc0c0e817dbf5b41319d9.tar.bz2 luaatc_envs-c18c5b9025435f294decc0c0e817dbf5b41319d9.zip |
State at 2023-11-12
-rw-r--r-- | Crossroads/nodes/(1780,27,929).lua | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Crossroads/nodes/(1780,27,929).lua b/Crossroads/nodes/(1780,27,929).lua new file mode 100644 index 0000000..98c6d83 --- /dev/null +++ b/Crossroads/nodes/(1780,27,929).lua @@ -0,0 +1,48 @@ +if event.type ~= "punch" then + return +end + +local st = {} +local function println(str) + table.insert(st, str) +end +local function printf(fmt, ...) + return println(string.format(fmt, ...)) +end + +local lines = F.lines +local linenames = {} + +for k in pairs(lines) do + table.insert(linenames, k) +end +table.sort(linenames) + +for _, linename in ipairs(linenames) do + local line = lines[linename] + printf("Line: %s", linename) + printf("Ring: %s", line.ring) + printf("Interval: %s", line.interval or "?") + printf("Trip length: %s", line.rtt or "?") + for tripnum, trip in ipairs(line) do + printf("Trip #%d", tripnum) + for _, stn in ipairs(trip) do + local stnline = ("%-27s %-3s"):format(F.stnlist[stn[1]] or stn[1], stn[2]) + if stn[3] then + stnline = stnline .. (" %02d:%02d"):format(math.floor(stn[3]/60), stn[3]%60) + end + println(stnline) + end + end + println("") +end + +local text = table.concat(st, "\n") +digiline_send("mfu", { + command = "PRINT", + copies = 1, + author = "Station Control Center", + title = "Timetable", + text = text, + watermark = "CRT_" .. os.time(), +})
\ No newline at end of file |