This is a table of modules and functions that were created specifically for facilitating the creation of other modules. Documentation for modules here is done in the source code with Template:Helper module.
Module | Function | Type | Use |
---|---|---|---|
Addcommas | _add(arg) | Number | Formats the number arg with commas |
_strip(arg) | Number | Removes all commas from arg | |
Yesno | (arg) | Any value | Reads arg for yes/no and returns the appropriate boolean or nil |
(arg1,arg2) | Any value, Any value | Reads arg1 for yes/no and returns the appropriate boolean; returns arg2 if arg1 was not an applicable value | |
Number | _round(num, dp) | float, int | Rounds num to a precision given by dp , if dp is not specified, it defaults to zero. |
_short(str) | String | Convert numbers ending in k, m or b to the actual correct number. Example: 3.5k -> 3500 | |
Paramtest | is_empty(arg) | String | Returns true if arg is not defined or contains only whitespace |
has_content(arg) | String | Returns true if arg exists and does not only contain whitespace | |
default_to(arg1,arg2) | String, Any value | If arg1 exists and does not only contain whitespace, the function returns arg1, otherwise returns arg2 | |
defaults{ {arg1,arg2},...} | {String, Any value}... | Does the same as default_to() run over every table passed; for technical reasons, all nil are replaced with false | |
Exchange | _price(arg) | String | Gets the current median price of item named arg |
_value(arg) | String | Gets the value of item named arg | |
Mainonly | _main(arg) | Any value | If the module is invoked in the content namespace, it will return arg, otherwise, it will return an empty string |
on_main() | N/A | Returns true if invoked in the content namespace, otherwise false | |
Edit button | (text) | string | Creates an edit button for the current page that the module is invoked ontext defaults to "edit" |
Reftag | {attr} | table | Table of attributes may include:
|
Tables | _row(row, elts, header) | mw.html object, table/string, boolean | Adds td or th cells to the html object with the cells data specified by elts . If header = true then all cells added will have the th tag. |
_table(table, data) | mw.html object, table | Adds tr rows and td /th cells to the html object, the data for the rows and cells is specified by data . | |
ExchangeLite | load(frame) | table of form {args={'item', 'dataType'} } | Lightweight version of Module:Exchange. Returns the data type requested for the specified item. Any of the fields of an exchange page can be used (see Exchange:Fire rune) |
price(item) | string | Takes an item name; returns the Grand Exchange price | |
Coins image | (num) | string,number | Creates the correct coins image for the number |
DPL scroll | _main(args) | table | Generates pagination for usage in DPL headers; see Template:Extension DPL scroll for template version. Table of attributes may include:
|
Logger | log(table) | table | Logs the contents of the table to the console (does not expand subtables).
Notes:
|
deep_log(table) | table | Logs the contents of the table to the console, expanding subtables. See above notes. | |
Currency | _amount(a, coinType) | number/string, string | Returns the number a with the correct image in front of it and formatted with commas. Current supported cointypes are coins , rusty and chimes . |
Currency short | _amount(a, coinType, precise) | number/string, string, boolean | Returns the number a with the correct image in front of it and formatted with commas. Also shortens the number to k or M if needed unless precise = true . Current supported cointypes are coins , rusty and chimes . |
StringTables | _stringTable(inArr) | table | Generates an html table and returns it as a string. This is faster than creating an mw.htmlobject and then converting it to a string using the tostring() methode. This function is also faster then _tableToString(tbl) |
_tableToString(tbl) | mw.html table object | Converts the mw.html table object into a string. This function is faster than the tostring() methode. |