Final Fantasy Wiki
Advertisement
FFWiki forum logo
Forums: Index > The Labyrinth of Time > Lua and the future of wikitemplates


Hey guys, Catuse here after ... months of being away, I hope to stick around for a while now since I have nothing better to do.... Anyways, Wikia recently announced that Lua can now be used as a server-side language to replace ParserFunctions and other complex template commands. Why should we care? Well, for one thing, less loading time. Grunny calculated about 35%-50% faster page loads with Lua rather than wikitext on the Marvel Database. It also greatly helps with code readability. While templates like {{tl|gallery}} are much, much better than they used to be (anyone remember the mess of ParserFunctions, wikitext, and HTML that thing was back in 2011?) we'd still be in trouble if JBed was to disappear tomorrow and then something changed that made {{tl|gallery}} unusable.

I was going to recreate an enemy infobox in Lua using the code Wikia provided us with. The problem is Wikia hasn't actually implemented Lua yet <_< so that'll have to wait. Oops.

Anyways, the two big responses to this are probably going to be:

  • "But we don't know Lua, how can we implement it?" Well I don't know Lua either, but it's known for being easy to learn. Annoyingly, Wikia didn't put any comments in the infobox code they provided us with, but it doesn't take a genius to figure out how it works, and there's also Lua's manual.
  • "The wiki has much more important things going on, why would we waste manpower on this?" I figure this is a low-priority job, so we can take our sweet time on it; it doesn't directly affect viewers, except in terms of loading times. Also, thanks to metatemplating, this should be done with much faster than one think. C A T U S E 20:23, June 17, 2014 (UTC)
I support using Lua. It requires learning a ton of stuff, but it would be sweet, for our users. I would love to develop with it if it's really helpful. Particularly because I like to metatemplate things, this would be incredibly sweet. I had an idea for developing an Infobox metatemplate. The only issue I can see with that is "longer load times", but Lua appears to solve the issue.
I've seen the differences in parser speed that Lua provides, and it's pretty awesome. In fact, if Lua can really replace ParserFunctions almost entirely, then I suppose some parts of the Navbox metatemplate can be rewritten to solve that problem too.
It's exciting stuff, for sure.--FFVI Kefka Palazzo Sprite iOS Technobliterator TC 20:35, June 17, 2014 (UTC)
Lua...... I associate that name with Android. I think I used it briefly for Android apps. I hated it.
Also I don't understand how Lua can be faster than parser functions. 89.243.247.9 21:10, June 17, 2014 (UTC)
You'd have to ask Wikia staff. My best guess is that it gets interpreted by the server itself, rather than being converted into some sort of PHP script that then gets interpreted. C A T U S E 22:41, June 17, 2014 (UTC)

I have had a look into it once again. I will probably have to learn it a decent amount, but from what I see, it's just writing a function in the "Module" namespace. The potential I see for this:

  1. If we write Parser Functions in Modules, it could almost replace them.
  2. We could use it to replace our own 'custom' parsers like {{Ifstring}}.
  3. It could replace Semantic MediaWiki entirely, that means more for the other wikis I edit on, but for this wiki, it could be our answer to the lack of Arraymap.
  4. It could probably reduce a lot of the code on the Navbox templates. I'm referring most to the code found aux1 which handles the options parameters.
  5. I could use it to make writing an Infobox metatemplate much easier and much more plausible.

My only negative is it sounds too good to be true, I'm skeptical that I'll just be disappointed. If I can learn to write modules, then maybe it'll be alright.--FFVI Kefka Palazzo Sprite iOS Technobliterator TC 12:50, June 18, 2014 (UTC)

Well, this is likely Wikia's answer to Semantic MediaWiki.
Its main benefit will be in writing our own parsers. And apparently rewriting MediaWiki's parser functions (which is why I'm so confused as to how Lua can be faster: Wikia can rewrite the parser functions in Lua themselves if they want!).
If we can get Lua scripts to run on every page that would be nice. But I doubt it. This would allow me to move over client-side scripts to server-side. Although I'm not sure if interaction with elements will work. I don't know when it runs! (actually, yes I do, where you call it, duh) I'm not sure what we have access to either. All the PHP variables (which is all the JS variables, possibly site messages too)? (I suspect not) JBed (talk) 14:53, June 18, 2014 (UTC)
Advertisement