Quantcast WoWInterface - View Single Post - Include files
Thread: Include files
View Single Post
09-21-18, 11:05 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,203
The files load in the order in the .toc.

The "NameSpace" is already a table passed in by Blizzard so you don't need to create a second one.

File 1
Lua Code:
  1. local addonName, NS = ...
  2.  
  3. NS.a = {}

File 2
Lua Code:
  1. local addonName, NS = ...
  2.  
  3. local function LocalTest(val)
  4.      print(val)
  5. end
  6.  
  7. NS.a.Test =  LocalTest
File 3
Lua Code:
  1. local addonName, NS = ...
  2. NS.a.Test("Hi there.")

you don't add the () when assigning the function unless you want to assign the result of calling the function.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-21-18 at 11:34 AM.
  Reply With Quote