summaryrefslogtreecommitdiff
path: root/chat.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-04 03:16:25 +0100
committerubq323 <ubq323@ubq323.website>2022-08-04 03:16:25 +0100
commita502e58c63fb560c534c4557f9561ad091e2ece1 (patch)
tree935d99e0e55721b0653ac15141afe6a048d55f5a /chat.lua
parentce59711d67658bf550772158087923db5a716d51 (diff)
chat
Diffstat (limited to 'chat.lua')
-rw-r--r--chat.lua5
1 files changed, 5 insertions, 0 deletions
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