View Single Post
04/29/14, 11:59 AM   #5
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
I think a good place for you to start reading is how Lua's scope works.

You should read something more in-depth, but here's a quick and dirty explanation.
Lexical scope; "local" variables are local to the block in which they're defined. If they're not defined as local, they are global. Local variables are local to anything in the block in which their defined, including all nested blocks.
Declaring local outside of a block in a file makes that variable local to the whole file. A file can be thought of as a block of code.
Files are not classes, nor can they really be considered objects. They're scripts. Blocks of code. With the script you can define classes and semantics for creating objects.

For some examples about how objects work (in the ESO add-on world, specifically), check out "LootDrop" or "Advanced Filters". You can also look up "Lua classes". It requires some trickery with things called metatables to simulate OO.

Re-reading all that, I dunno how well I did at explaining anything...
  Reply With Quote