Board Thread:Support Requests - Getting Technical/@comment-24171593-20161102100120/@comment-168424-20161103211402

Basically do your calculations in Lua instead of parser functions. With lots of calculations, Lua is much easier to read.

The drawback is setting up and understanding Lua initially can be a steep learning curve... I found most of the tricky parts were in reading params and handling various corner cases.

You can see an example of a Lua-based template I did here: Template:Buildinglink.

The Lua code is at Module:Buildinglink and the data is at Module:Buildinglink/link_icon_data.json

Once I did one, though, making similar ones became much easier. I have like a dozen templates similar to the one I linked.