WoW:Getting started with writing AddOns: Difference between revisions

Line 64: Line 64:
[[Lua]] files contain functional pieces of code. You may choose to only have one of these or break up your code into multiple files for a specific purpose. Here's a short example of one:
[[Lua]] files contain functional pieces of code. You may choose to only have one of these or break up your code into multiple files for a specific purpose. Here's a short example of one:


<pre>
  function MyAddOn_OnLoad()
  function MyAddOn_OnLoad()
     SlashCmdList["MyAddOn"] = MyAddOn_SlashCommand;
     SlashCmdList["MyAddOn"] = MyAddOn_SlashCommand;
Line 69: Line 70:
     this:RegisterEvent("VARIABLES_LOADED")
     this:RegisterEvent("VARIABLES_LOADED")
  end
  end
</pre>


<pre>
  function MyAddOn_SlashCommand()
  function MyAddOn_SlashCommand()
     print("Hello, WoW!")
     print("Hello, WoW!")
  end
  end
</pre>


=== XML Files ===
=== XML Files ===