Thread Tools Display Modes
02/13/15, 01:22 PM   #1
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
[outdated] Suggestion to allow GuiXML in libraries

Note that we're in » Developer Discussions » Wish List »

As Garkin explained to me earlier this week, you can't put an XML with controls in a library. Because when multiple add-ons embed that library, the controls' names will clash. Sure, it's not desperately needed, as almost everyhing can be done in Lua. Anyway, here's my idea how it could be made possible:

Lua Code:
  1. <GuiXml id="libWarehouse" version="23">
  2.     ...
  3. </GuiXml>

Method 1 - unique id .. version - easier to implement
When loading an XML with id .. version combination you already loaded, skip it, don't process its contents.
Add-on devs will have to include version in every control in that file, so that they don't conflict with controls from other versions.

Method 2 - highest version per id - easier to use
When loading an XML, check the previously loaded version. If it's greater or equal, skip. Otherwise continue processing the contents.
When you encounter a duplicate control name, and the previous definition came from a file with the same id, replace the definition instead of yielding an error.


Could this work, or are there other pitfalls?

Late edit: by controls in a library I mean virtual controls, aka templates.

Last edited by merlight : 02/13/15 at 04:59 PM.
 
02/13/15, 04:39 PM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
Note that we're in » Developer Discussions » Wish List »

As Garkin explained to me earlier this week, you can't put an XML with controls in a library. Because when multiple add-ons embed that library, the controls' names will clash. Sure, it's not desperately needed, as almost everyhing can be done in Lua. Anyway, here's my idea how it could be made possible:

Lua Code:
  1. <GuiXml id="libWarehouse" version="23">
  2.     ...
  3. </GuiXml>

Method 1 - unique id .. version - easier to implement
When loading an XML with id .. version combination you already loaded, skip it, don't process its contents.
Add-on devs will have to include version in every control in that file, so that they don't conflict with controls from other versions.

Method 2 - highest version per id - easier to use
When loading an XML, check the previously loaded version. If its greater or equal, skip. Otherwise continue processing the contents.
When you encounter a duplicate control name, and the previous definition came from a file with the same id, replace the definition instead of yielding an error.


Could this work, or are there other pitfalls?
If they are going to do that they might as well ad some kind of automatic version checking for libraries (in general) to take place of libStub that would determine whether or not any of the files in the library get loaded instead of needing to have two different version checking systems running (LibStub for lua & the other for xml).
 

ESOUI » Developer Discussions » Wish List » [outdated] Suggestion to allow GuiXML in libraries


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off