Improving Addon Modularity and Compatibility

User avatar
DoctorX
Trespasser
Posts: 52
Joined: 10 Mar 2016, 00:36

Improving Addon Modularity and Compatibility

Postby DoctorX » 29 Sep 2017, 00:58

Probably one for the suggestions thread, but I'm giving it it's own topic incase you are about to tell me there is already a way to do this...

As I try to design my own addons to be more modular, it occurs to me it would be a lot more flexible if there were a way to extend system.ltx with a partnered file that would load alongside of it. Not sure how feasible it would be, but what I'm requesting is that when system.ltx loads, it would look for any other .ltx file that starts with "system" and add the contents of that file as if it were written directly into the original system.ltx file.

For instance, say I wanted to add some more dialogs. I could just modify the existing dialog files, but then it's a pain to keep them updated and, more importanly, if another addon maker modifies the same files, the addons are not going to be compatible.

A more modular way would be to make my own dialog file with the new dialogs, but now I need to #include them in system.ltx (or elsewhere, but again it would require modifying an existing file), plus for the case of dialogs I would need to add the file name in the [dialogs] section of system.ltx.

So big deal, modify system.ltx and include that in the addon, right? But now if every addon maker did that, no addons would be compatible with each other without requiring the user to do a lot of merging of the different system.ltx's on their own.

So what I'm getting at is this; what if it was possible for me to instead make a file called "system_newdialogs.ltx", the contents of that file for this example would look like this:

Code: Select all

#include "dialogs_new_dialogs.ltx"

[dialogs]
files = dialogs_new


When system.ltx loads, it loads itself as normal, but then also loads this file (or any other file with filename starting with "system"), which will include the dialogs_new_dialogs.ltx file and (this being the part that might not be possible) adds "dialogs_new" to the existing dialogs section in the original system.ltx

Getting sleepy and been staring at my computer screen for too long. Hope I'm making sense. :?

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest

cron