<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.visionaire-tracker.net/index.php?action=history&amp;feed=atom&amp;title=Basic_Lua%3A_Basics</id>
		<title>Basic Lua: Basics - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.visionaire-tracker.net/index.php?action=history&amp;feed=atom&amp;title=Basic_Lua%3A_Basics"/>
		<link rel="alternate" type="text/html" href="https://wiki.visionaire-tracker.net/index.php?title=Basic_Lua:_Basics&amp;action=history"/>
		<updated>2026-05-04T21:56:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.visionaire-tracker.net/index.php?title=Basic_Lua:_Basics&amp;diff=9941&amp;oldid=prev</id>
		<title>AFRLme: Created page with &quot;{| class=&quot;in&quot; |- | class=&quot;i_arrow clickablecell&quot; |  &lt; | class=&quot;i_norm clickablecell&quot; | '''Index''' | class=&quot;i_arrow clickablec...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.visionaire-tracker.net/index.php?title=Basic_Lua:_Basics&amp;diff=9941&amp;oldid=prev"/>
				<updated>2018-11-02T18:51:02Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| class=&amp;quot;in&amp;quot; |- | class=&amp;quot;i_arrow clickablecell&amp;quot; |  &lt;a href=&quot;/wiki/Basic_Lua:_Introduction&quot; title=&quot;Basic Lua: Introduction&quot;&gt;&amp;lt;&lt;/a&gt; | class=&amp;quot;i_norm clickablecell&amp;quot; | &amp;#039;&amp;#039;&amp;#039;&lt;a href=&quot;/wiki/Basic_Lua:_Index&quot; title=&quot;Basic Lua: Index&quot;&gt;Index&lt;/a&gt;&amp;#039;&amp;#039;&amp;#039; | class=&amp;quot;i_arrow clickablec...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| class=&amp;quot;in&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| class=&amp;quot;i_arrow clickablecell&amp;quot; |  [[Basic_Lua:_Introduction|&amp;lt;]]&lt;br /&gt;
| class=&amp;quot;i_norm clickablecell&amp;quot; | '''[[Basic_Lua:_Index|Index]]'''&lt;br /&gt;
| class=&amp;quot;i_arrow clickablecell&amp;quot; | [[Basic_Lua:_Operators|&amp;gt;]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here I am covering a few of the basic fundamentals of Lua script that I can't really create individual pages for. You will probably see most of these - in one context, or another - throughout the various pages of this guide.&lt;br /&gt;
&lt;br /&gt;
== Print ==&lt;br /&gt;
The print function is used for printing messages to the log file or lua console &amp;amp; is useful for debugging your scripts &amp;amp; functions.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;hello world&amp;quot;) -- prints &amp;quot;hello world&amp;quot; into the log/console (ah yes how cliché of me, but it had to be done)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Variables ==&lt;br /&gt;
Variables are like keywords that you can use to store &amp;amp; access data. Variables in Lua script can be local or global in scope, &amp;amp; unlike most other programming languages, they do not require you to specify their type when creating them as variables can be overwritten at any time with new data.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
a = 1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Concatenation ==&lt;br /&gt;
Concatenation is essentially the joining of two or more strings &amp;amp; is represented by two full stops like so '''..'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
a = &amp;quot;hello&amp;quot;&lt;br /&gt;
b = &amp;quot;world&amp;quot;&lt;br /&gt;
&lt;br /&gt;
print(a .. &amp;quot; &amp;quot; .. b) -- prints &amp;quot;hello world&amp;quot; - we had to add &amp;quot; &amp;quot; to create a space between the 2 words&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Global vs Local ==&lt;br /&gt;
Global &amp;amp; local refers to anything from variables, to tables, to functions. The difference between global &amp;amp; local is that local only works inside of the script or function that it was created in, whereas global can be used throughout multiple scripts. &lt;br /&gt;
&lt;br /&gt;
Global is often used for functions, tables &amp;amp; variables that need to be accessed by multiple scripts, or from various different locations.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local a = 1 -- only accessible in this script&lt;br /&gt;
&lt;br /&gt;
a = 1 -- can be accessed from anywhere&lt;br /&gt;
&lt;br /&gt;
function return_n(n) &lt;br /&gt;
 local a = n -- only valid inside of this function but can be returned outside of function&lt;br /&gt;
 return a &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;ts&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Quick note: ''you need to be careful when using global conventions, that you do not use the same instance in other scripts, as this would be considered cross-polluting &amp;amp; may break your script because you would be overwriting the existing data that the variable, or function contained.''&lt;br /&gt;
|}&lt;br /&gt;
== Comments ==&lt;br /&gt;
=== Single line comments ===&lt;br /&gt;
Can ''only'' be placed on their ''own line'' or at the ''end'' of a line.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- this is a single line comment&lt;br /&gt;
i = 10 -- comment placed after working code&lt;br /&gt;
-- comment place before code; i = 10 -- notice how the code is also commented out?&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== Multi-line comments ===&lt;br /&gt;
Can be placed anywhere in the script &amp;amp; allow you to write comments over multiple lines.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--[[&lt;br /&gt;
this is a multiple line comment&lt;br /&gt;
I can go on &amp;amp; on &amp;amp; on&lt;br /&gt;
&amp;amp; on &amp;amp; on&lt;br /&gt;
&amp;amp; on.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local i = 2 * --[[ this is a comment ]] 2&lt;br /&gt;
print(i) -- would print 4 to the log (2x2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== Nested multi-line comments ===&lt;br /&gt;
Allow you to comment out entire blocks of code, even if they already contain multi-line comments, thus preventing existing multi-line comments from ending the nested comment.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--[=[&lt;br /&gt;
this is a nested comment&lt;br /&gt;
see how --[[ we can include ]]&lt;br /&gt;
a multi-line comment inside of it?&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
this is what would happen if we were to use&lt;br /&gt;
a regular multi-line --[[ comment ]]&lt;br /&gt;
i = 10&lt;br /&gt;
]]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;in&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| class=&amp;quot;i_arrow clickablecell&amp;quot; |  [[Basic_Lua:_Introduction|&amp;lt;]]&lt;br /&gt;
| class=&amp;quot;i_norm clickablecell&amp;quot; | '''[[basic_Lua:_Index|Index]]'''&lt;br /&gt;
| class=&amp;quot;i_arrow clickablecell&amp;quot; | [[Basic_Lua:_Operators|&amp;gt;]]&lt;br /&gt;
|}{{toc}}&lt;/div&gt;</summary>
		<author><name>AFRLme</name></author>	</entry>

	</feed>