Board Thread:Lua Help/@comment-1466854-20140820125533

First off, let me say I'm very experienced with lua in general, but am decently new to wiki "scripting" and the limited implementation of lua we have to work with here. I'm quite certain what I want to do is beyond the scope of what is intended to be done for a wiki, because I'm simply not used to having limitations with lua. Bear with me, I'll get there. I'm looking for advice on how to do this -right-, even if the eventual answer is that most of the work isn't done in lua.

Having said all that, to sum it up, what I want to do is pull the data from 597 (currently, the count rises every 2-8 weeks) templates containing various data about the creatures in a game. What I do with it -after- that isn't something I'm worried about currently, it's just a pile of math and storing the results. I already am aware the storing bit will bite me next, but I'll deal with that when I come to it. I'm not willing to discard the concept of what I'm doing, rather I'm looking for advice on how to do it efficiently with the least user oversight possible. I have an idea for how to kludge this, but I'll get to that after I explain what I'm looking for.

The main two problems I'm seeing here are as follows:


 * I want to be able to get the list of templates from membership in a category, rather than supply it manually. This doesn't appear to be possible, but please correct me if I'm wrong.
 * I'm looking to pull data from a massive number of templates. Reasonably, this is probably going to be extremely expensive for the server to do and needs to be handled another way. Again, please correct me if I'm wrong.

The potential kludge solution:

So, realizing the issues with persistent storage, large-scale template queries, not being able to detect the category contents, etc, my current planned solution is a bit outside what I was hoping to do. Basically it seems to me the easiest way would be to write a javascript-based page for editor use and have that page use the mediawiki API to fetch all the category contents followed by the templates themselves. From there it would do the math necessary to generate the growth patterns I'm fetching all of these templates for and return the lua template, with the growth patterns included, for the editor to paste into the template page. Once it's all there, the rest of the script is decently simple and shouldn't run into any problems whatsoever. Also, I realize it's probably possible to make the script auto-update the template without requiring the user paste it, but I'm not sure that's something I want to encourage.

I think this would work just fine for what I'm doing, but I don't particularly like it. For one, I'm not nearly as experienced with javascript as I am with lua, and this'll take a decent bit of trial and error to get working properly. More importantly though, it'll be rather slow (API category content requests return ten at a time along with a key to continue the list, and the template requests themselves couldn't be simultaneous with a count that high) and by requiring an editor run that script manually to update the template, it requires someone manually force an update whenever a new pattern becomes known. If anyone has any ideas for how to make this happen in a simpler way, please do let me know. I'm unfortunately not expecting that to be the case though.

Thanks in advance to everyone who reads through this, regardless of what advice you may or may not have. 