Munurin millum rættingarnar hjá "Module:Gapnum/doc"

54 bytes løgd afturat ,  7 mánaðir síðan
s
Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html]
(Stovnaði síðu við "This module is used by {{tl|val}}. == Use in other modules == ===gaps=== The <code>gaps</code> function can be useful for formatting in other modules that...")
 
s (Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html])
 
The <code>gaps</code> function can be useful for [[MOS:DIGITS|formatting]] in other modules that work with displaying large numbers.
 
<sourcesyntaxhighlight lang="lua">
local gaps = require('Module:Gapnum').gaps
</syntaxhighlight>
</source>
 
Using the <code>gaps</code> function, the first argument is the number to format. The second argument can be a table with keys that tell the module how to format. The table keys that can be used are:
Note that the return statement is a table. This means more styling or text can be added to the wrapper span tag, but it may also mean that <code>tostring()</code> may be required when used in other modules.
 
<sourcesyntaxhighlight lang="lua">
local gaps = require('Module:Gapnum').gaps
 
local n_small_10 = gaps(n, {gap='1px', prec=10})
end
</syntaxhighlight>
</source>
 
===groups===
The <code>groups</code> function can be used in other modules to separate a number into groups as <code>gaps</code> does, but instead of a formatted <code>string</code>, the function will return tables whose elements are the separated groups.
 
<sourcesyntaxhighlight lang="lua">
local groups = require('Module:Gapnum').groups
 
local n4a,n4b = groups(123.4567,8)
end
</syntaxhighlight>
</source>
14.816

rættingar