XML to Lua?
So... I'm not very good with xml (old brain doesn't like it)
but I see a lot of UI examples in XML and I'm wondering if there is an easy way to convert them to lua code. As an example I found this page https://us.forums.blizzard.com/en/wo...-xml/1488298/2 Gello posted some XML code and I'm trying to convert it into lua code. Code:
<Ui> What would the lua code look like for the two buttons? |
Lua code for xml (found)
I went to ChatGPT https://chat.openai.com/ and asked them to convert the xml code to lua and the code below is the result.
Lua Code:
|
In XML, where you see parentKey, that is convert to a key on the parent frame (funny that)
Code:
<Button parentKey="CloseButton" inherits="UIPanelCloseButtonDefaultAnchors"/> Lua Code:
Because the parent frame has a (not very unique) name you can access the child frame (CloseButton) via the parent's key Lua Code:
|
Quote:
It's still a good idea to proofread any code GhatGPT spits out as it still makes mistakes. It sees parentKey and just shoves it in a local instead of assigning the object to that key in the parent's table, as Fizzlemizz pointed out. It also doesn't handle useParentLevel, which is to set the child's framelevel equal to its parent where by default, it's +1. |
All times are GMT -6. The time now is 06:16 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI