summaryrefslogtreecommitdiff
path: root/Crossroads
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:55:29 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:55:29 +0200
commitf680d326304e8f1efb43a01dbcc609bcbfd198fc (patch)
treee5bedec397968ed28e77009f61fad261ce8e36a2 /Crossroads
parentad8995e3386d88ad99a6f1d2747983d00dcf8597 (diff)
downloadluaatc_envs-f680d326304e8f1efb43a01dbcc609bcbfd198fc.tar.gz
luaatc_envs-f680d326304e8f1efb43a01dbcc609bcbfd198fc.tar.bz2
luaatc_envs-f680d326304e8f1efb43a01dbcc609bcbfd198fc.zip
State at 2021-12-20
Diffstat (limited to 'Crossroads')
-rw-r--r--Crossroads/nodes/(1755,27,943).lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/Crossroads/nodes/(1755,27,943).lua b/Crossroads/nodes/(1755,27,943).lua
index 135d7ab..227e164 100644
--- a/Crossroads/nodes/(1755,27,943).lua
+++ b/Crossroads/nodes/(1755,27,943).lua
@@ -1,5 +1,7 @@
local head = { "V TRAIN LINE STATION ", " " }
local length = 18
+local sformat = string.format
+
if event.type=="digiline" or event.type=="punch" then
if event.channel=="upd_main" or event.type=="punch" then
local table = table
@@ -17,8 +19,8 @@ if event.type=="digiline" or event.type=="punch" then
i = (counter-counter%7)/7*2+((counter%7<3) and 1 or 2)
if not la[i] then la[i] = (i%2==0) and {} or {head[1]} end
if not lb[i] then lb[i] = (i%2==0) and {} or {head[2]} end
- local n = string.format("[%s] %s", st.t or "?", F.stnlist[st.s] or st.s)
- la[i][#la[i]+1] = string.format("%02d %06d %-7s %s", st.v, ids[id], st.l, n)
+ local n = sformat("[%s] %s", st.t or "?", F.stnlist[st.s] or st.s)
+ la[i][#la[i]+1] = sformat("%02d %06d %-7s %s", st.v, ids[id], st.l, n)
lb[i][#lb[i]+1] = (n:len() < 10 and " " or n:sub(10))
counter = counter + 1
end
@@ -32,7 +34,7 @@ if event.type=="digiline" or event.type=="punch" then
local lagavg = 0
for i = 1, #S.lagrec, 1 do lagavg = lagavg + S.lagrec[i] end
lagavg = lagavg / #S.lagrec
- digiline_send("lag1", "DEBUG\nTRAINS: " .. counter .. "\nTS: " .. os.time())
- digiline_send("lag2", "CUR " .. (end_t - start_t) .. "\nMIN " .. S.lagrec[1] .. "\nMAX " .. S.lagrec[#S.lagrec] .. "\nAVG " .. lagavg)
+ digiline_send("lag1", sformat("DEBUG\nTRAINS: %d\nTS: %d", counter, os.time()))
+ digiline_send("lag2", sformat("CUR %f\nMIN %f\nMAX %f\nAVG %f", end_t - start_t, S.lagrec[1], S.lagrec[#S.lagrec], lagavg))
end
end \ No newline at end of file