lua tonumber奇怪的行为

时间:2018-05-28 17:24:39

标签: lua

当我使用tonumber()时,值会变为nil?

   luxValue = otherdevices['Lux Woonkamer']
   print("Lux: " .. luxValue)

Lux:55

luxValue = otherdevices['Lux Woonkamer']--still value 55
print("Lux: " .. tonumber(luxValue))

尝试连接nil值

luxValue = tostring(otherdevices['Lux Woonkamer'])--still value 55
print("Lux: " .. tonumber(luxValue))

尝试连接nil值

有人可以解释一下吗?

0 个答案:

没有答案