Module:Utils/doc

From Nguhcraft Wiki
Revision as of 11:02, 23 September 2025 by Annwan (talk | contribs)
Jump to navigation Jump to search

This is the documentation page for Module:Utils

Utility functions to help creating modules

def(value, default)

Returns value if it is not nil or "", and defaultotherwise

_a(arg)

Extracts the argument from the common ways mediawiki passes arguments to modules:
  • if arg is not a table, it is returned as is (Called from Lua like a function)
  • if arg is a table and that table has a args field, arg.args[1] is returned (Called from MediaWiki’s {{#invoke:}} parser function)
  • if arg is a table but doesn’t contain an args field, args[1] is returned (Called with a table as an argument list[1])

date(y, m, d, short = false)

Formats a date.
If short</text> is set to true, uses shortened months name instead of full length month names.
  1. Some mediawiki functions do that, idk why — Annwan