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:
<GuiXml id="libWarehouse" version="23">
...
</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.