Quantcast
Channel: Lua, if statement idiom - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Srdjan M. for Lua, if statement idiom

$
0
0

As pointed out by "Paul Kulchenko" in his last sentence, I ended up adding two idioms...

local a = {}local b = {}local c,d = (a~=nil) and 1 or 0, (a~=nil) and 1 or 0 -- prints "1 1"local c,d = (a==nil) and 1 or 0, (a==nil) and 1 or 0 -- prints "0 0"print(c,d)

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>