Lua Booleans in Lua

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


Booleans, truth, and falsity are straightforward in Lua. To review:

  1. There is a boolean type with exactly two values: true and false.
  2. In a conditional context (if, elseif, while, until), a boolean is not required. Any expression can be used.
  3. In a conditional context, false and nil count as false, and everything else counts as true.
  4. Although 3 already implies this: if you're coming from other languages, remember that 0 and the empty string count as true in conditional contexts in Lua.

Got any Lua Question?