User blog comment:Ducksoup/Why Wikia Evolves/@comment-24473195-20150619235105/@comment-4189499-20150620020349


 * Re Feature Overlap

I think that parser functions and Lua are good for different purposes. Parser functions are good for smaller templates, if you just want to change wording based on the existence or lack thereof of a simple parameter, such as with w:c:drwho.answers:template:C. It is only for the more complex templates that Lua is worth taking out, such as w:c:drwho.answers:template:See also. Both those templates were created by me in the last week, and the choice of Lua or parser function was directly linked to the complexity of the template. Yeah, I could have made both with Lua, but it would have added unneeded complexity to "template:c" which only needed a simple if statement, and I could have made both using parser functions, but that would have turned "template:see also" into a monster of a beast to edit.

The other problem with Lua is the lack of good documentation aimed at the scribunto extension of it that Wikia uses. Even the normal documentation can be hard for people not already familiar with programming, and that's not taking into account scribunto specific features, such as needing to parse arguments from the frame or having to declare and return the table p to make the module work. Even for somebody with some experience in other programming languages, this lack of making some of the most basic parts of scribunto templates explicitly clear has made it just that much harder to force the stupid things to work. I can say both things with confidence because back when Lua was first released on Wikia, I tried to learn it with no prior programming experience and just got confused, and after taking the first semester of an IT course which included programming in 2 other languages, the understanding of the logic flow in Lua templates is easy enough to understand and the basic syntax changes are understandable, but the syntax for the scribunto hasn't been documented clearly enough so still a lot of time is spent on trial and error and looking at other templates when it would be better if a help page just gave that basic information.

Because of these limitations of scribunto, especially the learning curve, I would say that there is still plenty of reason to use parser functions. You just have to be smart about what they're good for and when they should be used. While you don't want to see overly convoluted templates using a whole bunch of #ifexist and #Switch functions, you similarly don't want to have to write a Lua module for what would otherwise be a one line template with parser functions.