Skip to content

Commit

Permalink
fix nan
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Sep 21, 2021
1 parent f983b33 commit 5e4fd84
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xmake/core/base/serialize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ function serialize._make(obj, opt)
-- call make* by type
if type(obj) == "string" then
return serialize._makestring(obj, opt)
elseif type(obj) == "boolean" or type(obj) == "nil" or type(obj) == "number" then
elseif type(obj) == "boolean" or type(obj) == "nil" then
return serialize._makedefault(obj, opt)
elseif type(obj) == "number" then
if math.isnan(obj) then -- fix nan for lua 5.3, -nan(ind)
return "nan"
end
return serialize._makedefault(obj, opt)
elseif type(obj) == "table" then
return serialize._maketable(obj, opt)
Expand Down

0 comments on commit 5e4fd84

Please sign in to comment.