我想将 lua 数字保存到字符串和句柄中NaN
大小写正确。
检测任何 NaN 都很容易,x ~= x
.
然而,我发现只有一种检测方法是NaN
or -NaN
是使用tostring(x) == 'nan'
。有更好的方法吗?
代替tostring(x) == 'nan'
,不方便携带,可以和实际对比一下tostring
call: tostring(x) == tostring(0/0)
or tostring(x) == tostring(-(0/0))
取决于你的需要。如果需要多次比较,可以保存结果tostring
并重复使用它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)