From b02392dc642f15ded9422d3c7e051869f9d01927 Mon Sep 17 00:00:00 2001 From: Ollo Date: Sun, 14 Mar 2021 13:20:38 +0100 Subject: [PATCH] Refactored telnet code --- telnet.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/telnet.lua b/telnet.lua index cd30e31..da97109 100644 --- a/telnet.lua +++ b/telnet.lua @@ -26,13 +26,13 @@ function startTelnetServer() end) c:on("sent", function() if (#lines > 0) then - l1=nil - for k,v in pairs(lines) do if (k==1) then l1=v end end - if (l1 ~= nil) then - table.remove(lines, 1) - print( tostring(l1) ) - telnetClient:send(l1) - end + local line1=nil + for k,v in pairs(lines) do if (k==1) then line1=v end end + if ( line1 ~= nil ) then + table.remove(lines, 1) + print( tostring(line1) ) + telnetClient:send(line1) + end end end) print("Welcome to the Wordclock.")