View Single Post
01-15-11, 07:42 PM   #17
Xinhuan
A Chromatic Dragonspawn
 
Xinhuan's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 174
There are reasons why making frames in Lua is preferred over doing it in XML.

1. Error checking is easier. If the XML file contains a syntax error, WoW doesn't tell you which line it is on. You have to use an XML parser (such as opening the XML file in Internet Explorer) which will then tell you what line gave an error. The Lua interpreter doesn't give an error unless there is code that expects a frame to be present.

2. Creating frames in Lua is far less verbose. It is less lines of text and fits on a page of text easily rather than 3 times the amount of lines. Less chances of mistakes is good.

3. Frames in XML are always created (excluding templates). Frames in Lua have the opportunity to be created only when needed on demand.

4. For code in Lua to access a frame or texture created in XML easily, you need to name the frame/texture (which adds it to _G). Although this is circumventable with a bit of tricks, if the frame/texture is simply created in Lua and assigned to local variables or table subentries, we wouldn't have this problem.
__________________
Author of Postal, Omen3, GemHelper, BankItems, WoWEquip, GatherMate, GatherMate2, Routes and Cartographer_Routes
  Reply With Quote