3
我有以下lua代码。我不确定它在做什么以下lua代码没有意义
width = aspectRatio > 1.5 and 320 or math.ceil(480/aspectRatio)
这是短路吗?
我有以下lua代码。我不确定它在做什么以下lua代码没有意义
width = aspectRatio > 1.5 and 320 or math.ceil(480/aspectRatio)
这是短路吗?
这确实是一个短路。它的等值在C将是:
width = aspectRatio > 1.5 ? 320 : math.ceil(480/aspectRatio)
或英文:如果纵横比大于1.5,将宽度设置为320,否则将宽度设置为大于或等于该最小积分值480的分割和纵横比。
参考
真棒感谢队友 – user2206329