Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-19-13, 03:57 PM   #1
fRodzet
A Flamescale Wyrmkin
Join Date: Mar 2013
Posts: 114
H: Why XML and why LUA?

Greetings,

So ive read some books and some topics about LUA and XML. According to most information, LUA should be used for the behavior of an AddOn while XML is used for the Layout(Graphics) - however both can be used for either.

Now my question would be;

In cases like moving a frame, why is
<OnDragStart> self:StartMoving() </OnDragStart>
<OnDragStop> self:StopMovingOrSizing() </OnDragStop>

used over the easy LUA way of doing this?

function MakeMovable(frame)
frame:SetMovable(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
end

now any other frames/buttons/w.e can be moved by just adding like the following code:

local frame = CreateFrame("Button", "UIPanelButtonTemplateTest", UIParent, "UIPanelButtonTemplate")
frame:SetHeight(20)
frame:SetWidth(100)
frame:SetText("Test Button")
frame:ClearAllPoints()
frame:SetPoint("CENTER", 0, 0)
MakeMovable(frame)

putting MakeMovable(frame) now makes the Button i just created Movable in the same manner as the one in XML, however the XML requires that i write it for each frame i create aswell as Register the Event, while this can just call the MakeMovable function.

Maybe i don't quiete get the language yet, or is there an even simpler way to implement moveframes?

Regards,
fRodzet
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » H: Why XML and why 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