View Single Post
08-16-14, 07:54 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,335
This isn't restricted to just WoW. The entire file, known as the main chunk, is seen by Lua as a function. After compiling into its own binary format, Lua immediately runs the function generated. This is for each addon file, so if you need to stop your addon from loading, you need to put checks like this in all of the .lua files.

There are some restrictions to using return that follow the same rules as if they were in a function. They are required to be at the end of a scope. Note chunks are blocks of code in which locals defined within are isolated. This includes function definitions, conditional blocks, and loops. You may also force a chunk to be defined by using the do ... end block.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 08-18-14 at 01:09 PM. Reason: Corrected terminology
  Reply With Quote