summaryrefslogtreecommitdiffhomepage
path: root/lua.html.markdown
diff options
context:
space:
mode:
authorEv Bogdanov <evbogdanov.com@gmail.com>2018-09-08 21:09:42 +0300
committerEv Bogdanov <evbogdanov.com@gmail.com>2018-09-08 21:09:42 +0300
commit0799909efb0392cf1a2d42e5cad3439449fa9ddc (patch)
tree963a666e664cd3f74adbca6bef593ce66d4c2f5b /lua.html.markdown
parentb622673dae3441f1260401fbb44d90e0e4aea6a2 (diff)
parent49a2bf306fcf365192934d006a244a9033909850 (diff)
Merge remote-tracking branch 'upstream/master' into jquery-ru
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