diff options
-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 |