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'] Code:
local SR = _G['StaticsRecruiter'] Quote:
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. |
|
Also remember that the : notation for function calls shoud be used for created objects of classes (created via ZO_Object:SubClass() e.g. where you can use self to reference the created object), and not simple tables {}.
So if SR = {} only, better do not use function SR:FunctionName but SR.FunctionName and calls as well via . and not : notation. Easier to read and to understand. In the end it works with : too, right. But the usage of "self" for simple tables is not intended afaik |
Thank you for the quick replies everyone. It has been a while since I looked at that tutorial and had forgotten that it showed what I needed. I'll read that over again. Cheers!
|
All times are GMT -6. The time now is 05:26 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI