summaryrefslogtreecommitdiffhomepage
path: root/lua.html.markdown
diff options
context:
space:
mode:
authorJohn Gabriele <jgabriele@fastmail.fm>2018-09-10 02:05:03 -0400
committerJohn Gabriele <jgabriele@fastmail.fm>2018-09-10 02:05:03 -0400
commit3cfdf5777266d780a211cdad1c52755170097cc8 (patch)
tree8a269e1679f14ceac7a10c0592fa14bb947e5208 /lua.html.markdown
parent60eac5d50054ddae92bd23fb51f3acc1c306a762 (diff)
parent6d087ae0f289e7013807639cbd609f991f968166 (diff)
Merge remote-tracking branch 'origin/master' into patch-1
Diffstat (limited to 'lua.html.markdown')
-rw-r--r--lua.html.markdown5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua.html.markdown b/lua.html.markdown
index 1e2d4366..32174a81 100644
--- a/lua.html.markdown
+++ b/lua.html.markdown
@@ -62,6 +62,11 @@ if not aBoolValue then print('twas false') end
-- in C/js:
ans = aBoolValue and 'yes' or 'no' --> 'no'
+-- BEWARE: this only acts as a ternary if the value returned when the condition
+-- evaluates to true is not `false` or Nil
+iAmNotFalse = (not aBoolValue) and false or true --> true
+iAmAlsoNotFalse = (not aBoolValue) and true or false --> true
+
karlSum = 0
for i = 1, 100 do -- The range includes both ends.
karlSum = karlSum + i