Skip to content

Commit

Permalink
Remove NaN values (#667)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OgelGames authored Mar 14, 2024
1 parent 5978043 commit cffbc33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mesecons_luacontroller/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cffbc33

Please sign in to comment.