<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tw-modding.com/index.php?action=history&amp;feed=atom&amp;title=Lua%3AExpressions_%26_Operators</id>
	<title>Lua:Expressions &amp; Operators - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tw-modding.com/index.php?action=history&amp;feed=atom&amp;title=Lua%3AExpressions_%26_Operators"/>
	<link rel="alternate" type="text/html" href="https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;action=history"/>
	<updated>2026-05-14T07:29:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;diff=1213&amp;oldid=prev</id>
		<title>Grimmys: Add LUA tutorial category</title>
		<link rel="alternate" type="text/html" href="https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;diff=1213&amp;oldid=prev"/>
		<updated>2024-03-11T19:25:06Z</updated>

		<summary type="html">&lt;p&gt;Add LUA tutorial category&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:25, 11 March 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l114&quot;&gt;Line 114:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 114:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Apply arithmetic to a series of 3 or more numbers&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Apply arithmetic to a series of 3 or more numbers&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Compare the length of two separate tables&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Compare the length of two separate tables&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Lua Tutorials]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-415:rev-1213 --&gt;
&lt;/table&gt;</summary>
		<author><name>Grimmys</name></author>
	</entry>
	<entry>
		<id>https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;diff=415&amp;oldid=prev</id>
		<title>MrIncongruous: added a few explanations that don't appear on the &quot;chunks and statements&quot; section, which goes right before this one</title>
		<link rel="alternate" type="text/html" href="https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;diff=415&amp;oldid=prev"/>
		<updated>2021-07-22T05:53:18Z</updated>

		<summary type="html">&lt;p&gt;added a few explanations that don&amp;#039;t appear on the &amp;quot;chunks and statements&amp;quot; section, which goes right before this one&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:53, 22 July 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l41&quot;&gt;Line 41:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ~= “not equal to”&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ~= “not equal to”&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;All of these expressions result in a boolean value.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;All of these expressions result in a boolean value&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, that is, it tells you if the result of what you're saying is true or false&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = 10&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = 10&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = 7 + 3&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = 7 + 3&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l52&quot;&gt;Line 52:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(c &amp;gt; d) → true -- 8 is greater than 7&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(c &amp;gt; d) → true -- 8 is greater than 7&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(c &amp;lt; d) → false -- 8 is NOT less than 7&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(c &amp;lt; d) → false -- 8 is NOT less than 7&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It’s important to note that Lua will consider different types to be different values. A string and a number will always be different. Lua will throw an error if you attempt to compare – using less-than or greater-than – any two separate types. Lua will not throw an error for “==” and “~=”, and if they are separate types, they will always be inequal.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It’s important to note that Lua will consider different types to be different values. A string &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(ie a group of characters, like the word &amp;quot;hello&amp;quot; or the character sequence &amp;quot;15&amp;quot;) &lt;/ins&gt;and a number will always be different. Lua will throw an error if you attempt to compare – using less-than or greater-than – any two separate types. Lua will not throw an error for “==” and “~=”, and if they are separate types, they will always be inequal.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = 15&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = 15&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = &amp;quot;15&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = &amp;quot;15&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l62&quot;&gt;Line 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==== Logical Operators ====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==== Logical Operators ====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next up are our logical operators! We have three operators to concern ourselves with here &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;– &lt;/del&gt;and, or, and not.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next up are our logical operators! We have three operators to concern ourselves with here&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;: ''&lt;/ins&gt;and&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;or&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;, and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;not&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;''Not'', as a logical operator, is pretty simple and super handy. It basically converts the value to the right of it into a boolean, and reverses it. Any value other than &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; will be converted into &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; will be converted to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;. Let’s take a look:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;''Not'', as a logical operator, is pretty simple and super handy. It basically converts the value to the right of it into a boolean, and reverses it. Any value other than &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; will be converted into &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; will be converted to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;. Let’s take a look:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l73&quot;&gt;Line 73:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 73:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(c) → 100&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(c) → 100&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(not not c) → true -- c is a number, &amp;quot;not c&amp;quot; would become &amp;quot;false&amp;quot;, and &amp;quot;not false&amp;quot; would become &amp;quot;true&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(not not c) → true -- c is a number, &amp;quot;not c&amp;quot; would become &amp;quot;false&amp;quot;, and &amp;quot;not false&amp;quot; would become &amp;quot;true&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The operators and and or are the hearts of a lot of logic in Lua. “If this and this, then do this”.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The operators &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;and&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;or&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;are the hearts of a lot of logic in Lua. “If this and this, then do this”.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = 15&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = 15&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = false&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = false&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l84&quot;&gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I don’t really have a category for these two operators, but they’re incredibly important.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I don’t really have a category for these two operators, but they’re incredibly important.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;First off, we have concatenation, which we’ve seen before. It’s a way to add two strings together, and make them into one happy family, using a simple pair of dots.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;First off, we have concatenation, which we’ve seen before. It’s a way to add two strings &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of characters &lt;/ins&gt;together, and make them into one happy family, using a simple pair of dots.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = &amp;quot;Hello&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;a = &amp;quot;Hello&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = &amp;quot;World!&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      b = &amp;quot;World!&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l90&quot;&gt;Line 90:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 90:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A couple of notes real quick – I have the blank space in a string in the middle, to make sure it doesn’t print “HelloWorld!”. Also, I like to add spaces on either side of my concatenation operator, but that’s personal taste, this would also be valid:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A couple of notes real quick – I have the blank space in a string in the middle, to make sure it doesn’t print “HelloWorld!”. Also, I like to add spaces on either side of my concatenation operator, but that’s personal taste, this would also be valid:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;out(a..&amp;quot; &amp;quot;..b) → Hello World!&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;out(a..&amp;quot; &amp;quot;..b) → Hello World!&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;And lastly, we have one more operator, and this time for the table type. The character &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; can be used to read the number of entries within an array. It’s pretty awesome, let me show you:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;And lastly, we have one more operator, and this time for the table type. The character &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; can be used to read the number of entries within an array &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(NOTE: an array is a set of different elements under one variable name)&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;It’s pretty awesome, let me show you:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;table = {&amp;quot;this&amp;quot;, &amp;quot;is&amp;quot;, &amp;quot;an&amp;quot;, &amp;quot;example&amp;quot;, &amp;quot;array&amp;quot;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &amp;lt;code&amp;gt;table = {&amp;quot;this&amp;quot;, &amp;quot;is&amp;quot;, &amp;quot;an&amp;quot;, &amp;quot;example&amp;quot;, &amp;quot;array&amp;quot;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(#table) → 5 -- there are five strings within the table!&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      out(#table) → 5 -- there are five strings within the table!&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-146:rev-415 --&gt;
&lt;/table&gt;</summary>
		<author><name>MrIncongruous</name></author>
	</entry>
	<entry>
		<id>https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;diff=146&amp;oldid=prev</id>
		<title>Vandy: Created page with &quot;  As we’ve seen, Lua is made up of &lt;code&gt;chunks&lt;/code&gt; and &lt;code&gt;statements&lt;/code&gt;. Statements can contain variables, and all variables have a type, though it can change at...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tw-modding.com/index.php?title=Lua:Expressions_%26_Operators&amp;diff=146&amp;oldid=prev"/>
		<updated>2021-02-07T18:40:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;  As we’ve seen, Lua is made up of &amp;lt;code&amp;gt;chunks&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;statements&amp;lt;/code&amp;gt;. Statements can contain variables, and all variables have a type, though it can change at...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
As we’ve seen, Lua is made up of &amp;lt;code&amp;gt;chunks&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;statements&amp;lt;/code&amp;gt;. Statements can contain variables, and all variables have a type, though it can change at any point.&lt;br /&gt;
&lt;br /&gt;
Expressions are the section of a statement that, essentially, tell Lua ''what to do''. They come in a billion different shapes and sizes. For now, we’ll cover all the basics you’ll need, and some basics you really don’t need but I’ll hand it to you anyway, and we’ll go back and review some older stuff. Here we go!&lt;br /&gt;
&lt;br /&gt;
==== Math Operators ====&lt;br /&gt;
Sweet. This is what all of those quizzes in grade school trained you for. We have the big four from algebra – addition, subtraction, multiplication, and division.&lt;br /&gt;
     &amp;lt;code&amp;gt;out(2 + 3) → 5&lt;br /&gt;
     out(5 - 1) → 4&lt;br /&gt;
     out(16 * 3) → 48&lt;br /&gt;
     out(9 / 3) → 3&amp;lt;/code&amp;gt;&lt;br /&gt;
We can also use a &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; to ''negate'' a value, or, in simple terms, turn a positive number into a negative and vice versa.&lt;br /&gt;
     &amp;lt;code&amp;gt;a = 10&lt;br /&gt;
     b = -20&lt;br /&gt;
     out( -a ) → -10&lt;br /&gt;
     out( -b ) → 20&amp;lt;/code&amp;gt;&lt;br /&gt;
We also have a couple other fun math things. We can raise numbers to any power, using an exponential expression.&lt;br /&gt;
     &amp;lt;code&amp;gt;a = 2&lt;br /&gt;
     b = 4&lt;br /&gt;
     c = 3&lt;br /&gt;
     out( a^a ) → 4&lt;br /&gt;
     out( b^c ) → 64&lt;br /&gt;
     out( 64^0.5 ) → 8 -- getting the square root of a number!&amp;lt;/code&amp;gt;&lt;br /&gt;
We can also use some modulo math. It’s a way of dividing two numbers that gives you the amount ''remaining'', and it’s a great way to read if a number is a ''multiple'' of another.&lt;br /&gt;
     &amp;lt;code&amp;gt;out(8 % 2) → 0 -- 8/2 = 4, and divides evenly, so nothing is remaining!&lt;br /&gt;
     out(7 % 2) → 1 -- 7/2. &amp;quot;6/2&amp;quot; divides evenly, so we subtract 6 from 7, and get &amp;quot;1&amp;quot; as the remainder!&lt;br /&gt;
     out(8 % 3) → 2 -- 8/3. &amp;quot;6/3&amp;quot; divides evenly, so we subtract 6 from 8, and get &amp;quot;2&amp;quot; as the remainder.&amp;lt;/code&amp;gt;&lt;br /&gt;
As said, it’s a great way to read if a number is a multiple of another. If a modulo expression returns “0”, that means it divided evenly, and is therefore a multiple of the number divided by.&lt;br /&gt;
&lt;br /&gt;
And that’s math!&lt;br /&gt;
&lt;br /&gt;
==== Comparison Operators ====&lt;br /&gt;
This sounds a lot more complicated than “math”, eh? It’s not that complicated – we’re comparing how two variables relate to one another, using expressions we’ve all seen before. The list of comparison operators are as follows:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt; — “less than”&lt;br /&gt;
* &amp;gt; — “greater than”&lt;br /&gt;
* &amp;lt;= — “less than or equal to”&lt;br /&gt;
* &amp;gt;= “greater than or equal to”&lt;br /&gt;
* == “equal to”&lt;br /&gt;
* ~= “not equal to”&lt;br /&gt;
&lt;br /&gt;
All of these expressions result in a boolean value.&lt;br /&gt;
     &amp;lt;code&amp;gt;a = 10&lt;br /&gt;
     b = 7 + 3&lt;br /&gt;
     out(a == b) → true -- they ARE equal!&lt;br /&gt;
     out(a ~= b) → false -- they ARE NOT not equal (weird, I know)!&lt;br /&gt;
 &lt;br /&gt;
     c = 8&lt;br /&gt;
     d = 7&lt;br /&gt;
     &lt;br /&gt;
     out(c &amp;gt; d) → true -- 8 is greater than 7&lt;br /&gt;
     out(c &amp;lt; d) → false -- 8 is NOT less than 7&amp;lt;/code&amp;gt;&lt;br /&gt;
It’s important to note that Lua will consider different types to be different values. A string and a number will always be different. Lua will throw an error if you attempt to compare – using less-than or greater-than – any two separate types. Lua will not throw an error for “==” and “~=”, and if they are separate types, they will always be inequal.&lt;br /&gt;
     &amp;lt;code&amp;gt;a = 15&lt;br /&gt;
     b = &amp;quot;15&amp;quot;&lt;br /&gt;
     out(a == b) → false -- they are different types!&lt;br /&gt;
     out(a &amp;gt;= b) → error (attempt to compare number with string)&amp;lt;/code&amp;gt;&lt;br /&gt;
Do note that you can compare strings using greater or less than, but it compares the alphanumerical order of the first character. “0” is less than every number or letter, whereas “a” is greater than every number and less than every letter, and “z” is greater than every number or letter. Again, not really important, but you came here to read me ramble on about random stuff.&lt;br /&gt;
&lt;br /&gt;
And that ends our comparison operators!&lt;br /&gt;
&lt;br /&gt;
==== Logical Operators ====&lt;br /&gt;
Next up are our logical operators! We have three operators to concern ourselves with here – and, or, and not.&lt;br /&gt;
&lt;br /&gt;
''Not'', as a logical operator, is pretty simple and super handy. It basically converts the value to the right of it into a boolean, and reverses it. Any value other than &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; will be converted into &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; will be converted to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;. Let’s take a look:&lt;br /&gt;
     &amp;lt;code&amp;gt;a = true&lt;br /&gt;
     b = nil&lt;br /&gt;
     out(not b) → true -- prints a double negative - not false, so true&lt;br /&gt;
     out(not a) → false -- reverses the value of &amp;quot;true&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     c = 100&lt;br /&gt;
     out(c) → 100&lt;br /&gt;
     out(not not c) → true -- c is a number, &amp;quot;not c&amp;quot; would become &amp;quot;false&amp;quot;, and &amp;quot;not false&amp;quot; would become &amp;quot;true&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
The operators and and or are the hearts of a lot of logic in Lua. “If this and this, then do this”.&lt;br /&gt;
     &amp;lt;code&amp;gt;a = 15&lt;br /&gt;
     b = false&lt;br /&gt;
     if a == 15 and not b then -- &amp;quot;if a is equal to the number fifteen, and &amp;quot;not b&amp;quot; returns true, then ... &amp;quot;&lt;br /&gt;
         out(&amp;quot;It does the thing!&amp;quot;) -- &amp;quot; ... print the text! &amp;quot;&lt;br /&gt;
     end&amp;lt;/code&amp;gt;&lt;br /&gt;
You’ll practically always see these two used in this way, for ''conditional statements'' like that – if these conditions work out, then do this other thing.&lt;br /&gt;
&lt;br /&gt;
==== Homeless Operators ====&lt;br /&gt;
I don’t really have a category for these two operators, but they’re incredibly important.&lt;br /&gt;
&lt;br /&gt;
First off, we have concatenation, which we’ve seen before. It’s a way to add two strings together, and make them into one happy family, using a simple pair of dots.&lt;br /&gt;
     &amp;lt;code&amp;gt;a = &amp;quot;Hello&amp;quot;&lt;br /&gt;
     b = &amp;quot;World!&amp;quot;&lt;br /&gt;
     out(a .. &amp;quot; &amp;quot; .. b) → Hello World!&amp;lt;/code&amp;gt;&lt;br /&gt;
A couple of notes real quick – I have the blank space in a string in the middle, to make sure it doesn’t print “HelloWorld!”. Also, I like to add spaces on either side of my concatenation operator, but that’s personal taste, this would also be valid:&lt;br /&gt;
     &amp;lt;code&amp;gt;out(a..&amp;quot; &amp;quot;..b) → Hello World!&amp;lt;/code&amp;gt;&lt;br /&gt;
And lastly, we have one more operator, and this time for the table type. The character &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; can be used to read the number of entries within an array. It’s pretty awesome, let me show you:&lt;br /&gt;
     &amp;lt;code&amp;gt;table = {&amp;quot;this&amp;quot;, &amp;quot;is&amp;quot;, &amp;quot;an&amp;quot;, &amp;quot;example&amp;quot;, &amp;quot;array&amp;quot;}&lt;br /&gt;
     out(#table) → 5 -- there are five strings within the table!&amp;lt;/code&amp;gt;&lt;br /&gt;
Please note that you really shouldn’t use the &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; operator if the table is not definitely an array. I’ll show you why using it on maps might mess something up:&lt;br /&gt;
     &amp;lt;code&amp;gt;table = {&lt;br /&gt;
         [1] = &amp;quot;test&amp;quot;,&lt;br /&gt;
         [2] = &amp;quot;example&amp;quot;,&lt;br /&gt;
         [5] = &amp;quot;boom&amp;quot;,&lt;br /&gt;
         [7000] = &amp;quot;woo&amp;quot;,&lt;br /&gt;
         [3] = &amp;quot;argh&amp;quot;&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     out(#table) → 7000&amp;lt;/code&amp;gt;&lt;br /&gt;
In technicalities, it’s doing that because it’s reading the ''highest index in that table'', or the highest numerical key. Those are assigned automatically, in order, for arrays; in maps, there’s no such guarantee.&lt;br /&gt;
&lt;br /&gt;
==== Challenge 1 ====&lt;br /&gt;
As before, go to repl.it and mess with everything.&lt;br /&gt;
&lt;br /&gt;
Some suggestions on what to try:&lt;br /&gt;
&lt;br /&gt;
* Make an array out of various strings, concatenate them together using &amp;lt;code&amp;gt;table[1]&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
* Apply arithmetic to a series of 3 or more numbers&lt;br /&gt;
* Compare the length of two separate tables&lt;/div&gt;</summary>
		<author><name>Vandy</name></author>
	</entry>
</feed>