Module:Utils/doc: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 10: | Line 10: | ||
<code>date(y, m, d, short = false)</code> | <code>date(y, m, d, short = false)</code> | ||
:Formats a date. | :Formats a date. | ||
:If <code>short</ | :If <code>short</code> is set to <code>true</code>, uses shortened months name instead of full length month names. | ||
Latest revision as of 11:02, 23 September 2025
Utility functions to help creating modules
def(value, default)
- Returns
valueif it is notnilor"", anddefaultotherwise
_a(arg)
- Extracts the argument from the common ways mediawiki passes arguments to modules:
- if
argis not a table, it is returned as is (Called from Lua like a function) - if
argis a table and that table has aargsfield,arg.args[1]is returned (Called from MediaWiki’s {{#invoke:}} parser function) - if
argis a table but doesn’t contain anargsfield,args[1]is returned (Called with a table as an argument list[1])
- if
date(y, m, d, short = false)
- Formats a date.
- If
shortis set totrue, uses shortened months name instead of full length month names.
- ↑ Some mediawiki functions do that, idk why — Annwan