Toggle menu
15
238
106
27.9K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Formatnum/doc: Difference between revisions

From Kenshi Wiki
Prd (talk | contribs)
Created page with "{{doc sub}} This module provides a number formatting function. This function can be used from #invoke or from other Lua modules. This module is used by Module:Complex date == Use from other Lua modules == To use the module from normal wiki pages, no special preparation is needed. If you are using the module from another Lua module, first you need to load it, like this: <syntaxhighlight lang="lua"> local mf = require('Module:Formatnum') </syntaxhighlight> (The <co..."
 
Prd (talk | contribs)
No edit summary
 
Line 30: Line 30:
[[Category:Modules]]
[[Category:Modules]]
}}</includeonly><noinclude>
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
[[Category:Module documents]]
</noinclude>
</noinclude>

Latest revision as of 01:49, 12 March 2025

This module provides a number formatting function. This function can be used from #invoke or from other Lua modules.

This module is used by Module:Complex date

Use from other Lua modules

To use the module from normal wiki pages, no special preparation is needed. If you are using the module from another Lua module, first you need to load it, like this:

local mf = require('Module:Formatnum')

(The mf variable stands for Module Formatnum; you can choose something more descriptive if you prefer.)

Most functions in the module have a version for Lua and a version for #invoke. It is possible to use the #invoke functions from other Lua modules, but using the Lua functions has the advantage that you do not need to access a Lua frame object. Lua functions are preceded by _, whereas #invoke functions are not.

main

{{#invoke:Formatnum|main|x|lang=|prec=|sep=}}
mf.formatNum(x, lang, prec, sep)

See also