【发布时间】:2020-11-24 22:01:45
【问题描述】:
我正在尝试在 Lua 4 中使用此功能:
function ternary(cond, T, F)
if cond then return T else return F end
end
在这种情况下:
loadHW1 = false
print(ternary(loadHW1 == true, "this should not appear", nil))
但是,当我希望结果为nil 时,总是会打印文本。我究竟做错了什么?谢谢。
[编辑]
我切换到这个,但仍然得到“这是真的”结果:
loadHW1 = 0
print(ternary(loadHW1, "this is true", "this is false"))
【问题讨论】: