<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://addonstudio.org/mw1/index.php?action=history&amp;feed=atom&amp;title=WoW%3ALua_basics</id>
	<title>WoW:Lua basics - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://addonstudio.org/mw1/index.php?action=history&amp;feed=atom&amp;title=WoW%3ALua_basics"/>
	<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;action=history"/>
	<updated>2026-05-10T13:45:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6287&amp;oldid=prev</id>
		<title>Move page script: Move page script moved page Lua basics to WoW:Lua basics without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6287&amp;oldid=prev"/>
		<updated>2023-08-15T04:48:34Z</updated>

		<summary type="html">&lt;p&gt;Move page script moved page &lt;a href=&quot;/wiki/WoW:Lua_basics&quot; title=&quot;WoW:Lua basics&quot;&gt;Lua basics&lt;/a&gt; to &lt;a href=&quot;/wiki/WoW:Lua_basics&quot; title=&quot;WoW:Lua basics&quot;&gt;Lua basics&lt;/a&gt; without leaving a redirect&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 04:48, 15 August 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key addonstu_asmw2:diff::1.12:old-6284:rev-6287 --&gt;
&lt;/table&gt;</summary>
		<author><name>Move page script</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6284&amp;oldid=prev</id>
		<title>Bear at 09:15, 21 May 2020</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6284&amp;oldid=prev"/>
		<updated>2020-05-21T09:15:59Z</updated>

		<summary type="html">&lt;p&gt;&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 09:15, 21 May 2020&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-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&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;{{Accuracy|Needs to have more lua file specific info. A bit too general.}}&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;{{Accuracy|Needs to have more lua file specific info. A bit too general.}}&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;{{&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;UIHowTo&lt;/del&gt;}}&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;{{&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;wow/uihowto&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;The &amp;#039;&amp;#039;[[World of Warcraft]]&amp;#039;&amp;#039; game client provides many functions available for use in &amp;#039;&amp;#039;&amp;#039;[[Lua]] script files&amp;#039;&amp;#039;&amp;#039; provided by [[AddOn]]s. These functions are the WoW API, are also used by [[Blizz]]ard to build the game client interface. They allow addons to query information about the player and the game world, to receive notifications (events) when the player interacts with the game world, and to  trigger player actions like changing target, casting spells, using professions, using vehicles, joining a group, etc.&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;The &amp;#039;&amp;#039;[[World of Warcraft]]&amp;#039;&amp;#039; game client provides many functions available for use in &amp;#039;&amp;#039;&amp;#039;[[Lua]] script files&amp;#039;&amp;#039;&amp;#039; provided by [[AddOn]]s. These functions are the WoW API, are also used by [[Blizz]]ard to build the game client interface. They allow addons to query information about the player and the game world, to receive notifications (events) when the player interacts with the game world, and to  trigger player actions like changing target, casting spells, using professions, using vehicles, joining a group, etc.&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;!-- diff cache key addonstu_asmw2:diff::1.12:old-6286:rev-6284 --&gt;
&lt;/table&gt;</summary>
		<author><name>Bear</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6286&amp;oldid=prev</id>
		<title>Bear at 19:55, 23 June 2016</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6286&amp;oldid=prev"/>
		<updated>2016-06-23T19:55:46Z</updated>

		<summary type="html">&lt;p&gt;&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 19:55, 23 June 2016&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-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&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;{{Accuracy|Needs to have more lua file specific info. A bit too general.}}&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;{{Accuracy|Needs to have more lua file specific info. A bit too general.}}&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;{{&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;wowlua&lt;/del&gt;}}&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;{{&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;UIHowTo&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;The &amp;#039;&amp;#039;[[World of Warcraft]]&amp;#039;&amp;#039; game client provides many functions available for use in &amp;#039;&amp;#039;&amp;#039;[[Lua]] script files&amp;#039;&amp;#039;&amp;#039; provided by [[AddOn]]s. These functions are the WoW API, are also used by [[Blizz]]ard to build the game client interface. They allow addons to query information about the player and the game world, to receive notifications (events) when the player interacts with the game world, and to  trigger player actions like changing target, casting spells, using professions, using vehicles, joining a group, etc.&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;The &amp;#039;&amp;#039;[[World of Warcraft]]&amp;#039;&amp;#039; game client provides many functions available for use in &amp;#039;&amp;#039;&amp;#039;[[Lua]] script files&amp;#039;&amp;#039;&amp;#039; provided by [[AddOn]]s. These functions are the WoW API, are also used by [[Blizz]]ard to build the game client interface. They allow addons to query information about the player and the game world, to receive notifications (events) when the player interacts with the game world, and to  trigger player actions like changing target, casting spells, using professions, using vehicles, joining a group, etc.&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;!-- diff cache key addonstu_asmw2:diff::1.12:old-6285:rev-6286 --&gt;
&lt;/table&gt;</summary>
		<author><name>Bear</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6285&amp;oldid=prev</id>
		<title>WoWWiki&gt;Fandyllic at 03:48, 19 June 2016</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:Lua_basics&amp;diff=6285&amp;oldid=prev"/>
		<updated>2016-06-19T03:48:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Accuracy|Needs to have more lua file specific info. A bit too general.}}&lt;br /&gt;
{{wowlua}}&lt;br /&gt;
The &amp;#039;&amp;#039;[[World of Warcraft]]&amp;#039;&amp;#039; game client provides many functions available for use in &amp;#039;&amp;#039;&amp;#039;[[Lua]] script files&amp;#039;&amp;#039;&amp;#039; provided by [[AddOn]]s. These functions are the WoW API, are also used by [[Blizz]]ard to build the game client interface. They allow addons to query information about the player and the game world, to receive notifications (events) when the player interacts with the game world, and to  trigger player actions like changing target, casting spells, using professions, using vehicles, joining a group, etc.&lt;br /&gt;
&lt;br /&gt;
=== Global variables in Lua ===&lt;br /&gt;
By default any new variable you create in Lua scripts is global, meaning the variable can be accessed (and overwritten) by other scripts that happens to use the same variable name. To create local variables, precede the new variable with the keyword &amp;quot;local&amp;quot;. Local variables are visible (and accessible) only from the file or block in which they are created.&lt;br /&gt;
&lt;br /&gt;
All AddOns in World of Warcraft share the same global variables. Considering many players have lots of AddOns installed and loaded at the same time, it quickly follows that AddOns should avoid simple names for their global variables. Otherwise it is rather easy for two AddOns to declare and use the same variable, ending with one of the AddOns overwriting that variable for the other.&lt;br /&gt;
&lt;br /&gt;
For this reason you should always use local variables everywhere in your script files, and only use a single global variable,  or a couple of them, with a longer name specific to your AddOn (so it is unlikely other AddOn will use the same name, for example: &amp;quot;RoleBuffAddOn&amp;quot;). Use this global name for a Lua object (table), that includes all other AddOn data you want to be available and visible between script files. If you only have a single script file, you can keep all your variables local.&lt;br /&gt;
&lt;br /&gt;
Same Lua scripts create a local variable named &amp;quot;m&amp;quot; and use it to store and retrieve data/functions for &amp;quot;the current module&amp;quot;, but I suggest you use &amp;quot;mod&amp;quot; instead. For example each of your scripts could include somewhere at the start:&lt;br /&gt;
 local mod = RoleBuffAddOn;&lt;br /&gt;
(here &amp;quot;RoleBuffAddOn&amp;quot; is a global object created by the first of your script files)&lt;br /&gt;
&lt;br /&gt;
This way scripts can put data and functions into the local object &amp;quot;mod&amp;quot;, and they will be available to all other scripts in your AddOn.&lt;br /&gt;
&lt;br /&gt;
=== Variable and function names ===&lt;br /&gt;
WoW API functions and event names provided by Blizzard begin with a capital letter, like IsMounted() or UnitIsUnit(). Note these are global names.&lt;br /&gt;
&lt;br /&gt;
For this reason you should keep your local variables and functions beginning with a lowercase letter, like combatCheckWarrior(). This way you know that new functions added by Blizzard in WoW API, will never introduce a conflict with your own function names.&lt;/div&gt;</summary>
		<author><name>WoWWiki&gt;Fandyllic</name></author>
	</entry>
</feed>