summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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