I have the following bit of lua code. I am not sure what it is doing
width = aspectRatio > 1.5 and 320 or math.ceil( 480 / aspectRatio )
is it a short circuit?
It is indeed a short circuit. It's equivalence in c would be:
width = aspectRatio > 1.5 ? 320 : math.ceil( 480 / aspectRatio )
Or in english: if the aspect ratio is greater than 1.5, set the width to 320, otherwise set the width to the smallest integral value that is greater than or equal to the division of 480 and the aspect ratio.
Reference
http://www.lua.org/pil/3.3.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With