Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Gapnum/doc
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===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. <syntaxhighlight lang="lua"> local groups = require('Module:Gapnum').groups function example() -- This will return one table: -- {123,456} local n1 = groups(123456) -- This will return two tables, each assigned to a different variable: -- n2a will be: -- {1,234} -- n2b will be: -- {567,89} local n2a,n2b = groups(1234.56789) -- This will return two tables: -- An integer part is always returned, even if it is 0 -- n3a will be: -- {0} -- n3b will be: -- {123,4567} local n3a,n3b = groups(0.1234567) -- Just like the other functions, a precision can be defined -- precision is simply the second parameter -- n4a will be: -- {123} -- n4b will be: -- {456,700,00} local n4a,n4b = groups(123.4567,8) end </syntaxhighlight>
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)