View Single Post
03/13/24, 06:20 AM   #1
static_recharge
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 35
Splitting up Add-on into Multiple Files

Hello I was hoping someone could explain to me good practices (and how they work) for splitting up a large add-on into multiple files. For example having one file for the settings menu information (settingsmenu.lua for example). I'm trying to mimic what I see in other add-ons by using _G[] and whatnot but I'm just not understanding the full picture and how methods play a role into this. I've tried the following code:

Start of StaticsRecruiter.lua
Code:
local SR = _G['StaticsRecruiter']
SR.addonName = "Static's Recruiter"
Start of SettingsMenu.lua
Code:
local SR = _G['StaticsRecruiter']
function SR:Create settings menu()
...
end
When my code runs it says it's attempting to index a nil value at the
function SR:Create settings menu()
line.

Any help or pointing in the right direction is appreciated. I tried searching the forums but I couldn't find anything on the subject. I might have been using the wrong terms. Thanks in advance.
  Reply With Quote