Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-01-24, 12:08 AM   #1
Codger
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2021
Posts: 35
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>
    <Frame name="SimpleFrame" parent="UIParent" inherits="DefaultPanelTemplate">
        <Size x="150" y="150"/>
        <Anchors>
            <Anchor point="CENTER"/>
        </Anchors>
        <Frames>
            <Button parentKey="CloseButton" inherits="UIPanelCloseButtonDefaultAnchors"/>
			<Frame parentKey="Inset" useParentLevel="true" inherits="InsetFrameTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" x="10" y="-26" />
					<Anchor point="BOTTOMRIGHT" x="-6" y="26" />
				</Anchors>
			</Frame>
            <Button parentKey="OkButton" inherits="UIPanelButtonTemplate" text="Okay">
                <Size x="90" y="22"/>
                <Anchors>
                    <Anchor point="BOTTOMRIGHT" x="-6" y="4"/>
                </Anchors>
                <Scripts>
                    <OnClick>
                        self:GetParent():Hide()
                    </OnClick>
                </Scripts>
            </Button>
        </Frames>
        <Scripts>
            <OnLoad>
                self.TitleContainer.TitleText:SetText("Simple Frame")
            </OnLoad>
        </Scripts>
    </Frame>
</Ui>
```
[/quote]
The frame part is simple enough but the button xml code has me baffled?
What would the lua code look like for the two buttons?
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » XML to Lua?


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