View Single Post
03/24/14, 02:27 PM   #7
Halja
 
Halja's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 111
Variable scope is always a fun question. I may have this wrong but here I go.
Game Global (G_) is a lua table and global to all
Ad-on's SavedVariable is lua table inside G_ and is global to all your add-on files.
lua file
var1 = "something" --is available to all files in the add-on
local var2 = "something" -- is scoped to the file only
local function
local var1 = "something" -- is scoped to the function call only
lua Class

local var1 = "something" -- is scoped to every thing in the class
local function
local var1 = "something" -- is scoped to the function call only



The 'include' part is the <ad-on>.txt file. I have not played with Bindings type files. So, I can not speak to the scope of those.
--halja
  Reply With Quote