Board Thread:Support Requests - Getting Technical/@comment-4356266-20150831135417/@comment-24473195-20150901082535

Mfaizsyahmi wrote: The whole point of wanting to use a Lua module is to ditch JS altogether, because it can't be done on mobile without using hacks, which I've tried, but my mobile site always ended up being broken when I tried inserting (hacking) a JS in. [ point of insertion | the js file ]

Dessamator wrote:

Mfaizsyahmi wrote: PS: the Utility module is also broken in its default state. How can I expect to utilize Lua when the libraries are broken? I saw the module being used in this page. From what I can tell there is nothing wrong with it. The issue is that you're using it incorrectly. That is a module meant to be used by other modules, not directly in a page, so using {{#invoke will never work in its current "default state". I see. So it can only be invoked from other modules? It isn't clearly indicated anywhere on the documentation. Well, documentation for lua modules are currently a "pain in the behind". There are no conventions in wikia for how to document modules. Wikipedia has their methods, but since lua modules are even less popular than javascript here, that  isn't likely to change anytime soon. That particular module is the only one in dev.wikia that is "relatively" well documented.

I've updated the documentation accordingly, see c:dev:Utility Module or c:dev:Lua Modules, I also suggest looking at w:c:dev:Getting started.

P.S. Dev.wikia is special. You don't need to copy a module from there to another  wikia to use it. Just use this something like this in a lua module to use it:

globalModule = require("Dev:Utility")

mw.log(globalModule.round(123123.22222,2))