From a502e58c63fb560c534c4557f9561ad091e2ece1 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Aug 2022 03:16:25 +0100 Subject: chat --- chat.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chat.lua b/chat.lua index a4ba800..4c38e16 100644 --- a/chat.lua +++ b/chat.lua @@ -57,6 +57,10 @@ local function maybe_sci(x) if #tostring(x) >= scorewidth then return sci(x) else return x end end +local function isnan(x) + return x ~= x +end + -- drawing -- lb @@ -121,6 +125,7 @@ while true do local _,user,msg = os.pullEvent"chat_message" local s = score(msg) userscores[user] = userscores[user] + s + if isnan(userscores[user]) then userscores[user] = 0 end p(M,string.format("(%d) <%s> %s",s,user,msg)) end -- cgit v1.2.3