Thread: XML or not XML?
View Single Post
01-22-08, 10:16 PM   #4
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
The misconception that you can't make templates in Lua is technically false. In fact it could be argued that Lua allows truer templating than XML. The reason I say this is that in XML you must actually create your template as a virtual object. In Lua you create a function that generates a frame based on whatever settings you tell it to use, as Malreth mentioned. In essence both approaches allow templating, they just do so in different ways. Ultimately the decision to use XML or Lua is primarily about what the author prefers. Some people like the structured design that XML affords, while others like the procedural generation that Lua provides.

One thing I would say Lua affords over XML is the fact that XML is setup in advance with the objects you want. If you needed to make a frame during a certain event, you would have to use Lua to do so, as XML isn't something that can be executed at will. For this reason I prefer to do it ALL via Lua, as I then have full control of when, how, and specifically what gets created. Like Malreth said you can easily define all of your attributes by passing arguments to a factory function, which means MUCH more flexibility in the long run.

Last edited by Beladona : 01-22-08 at 10:18 PM.
  Reply With Quote