From cffbc33e6dfcf01f62d890b7e71b4fb46cfc8063 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Fri, 15 Mar 2024 05:54:19 +1100 Subject: [PATCH] Remove NaN values (#667) NaN can cause problems (and errors) if the receiving node doesn't check for it, this PR makes it so NaN values are removed from digiline messages. --- mesecons_luacontroller/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 0ee2def..90516c0 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -388,7 +388,10 @@ local function clean_and_weigh_digiline_message(msg, back_references) return msg, #msg + 25 elseif t == "number" then -- Numbers are passed by value so need not be touched, and cost 8 bytes - -- as all numbers in Lua are doubles. + -- as all numbers in Lua are doubles. NaN values are removed. + if msg ~= msg then + return nil, 0 + end return msg, 8 elseif t == "boolean" then -- Booleans are passed by value so need not be touched, and cost 1