https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ANumberSpell
Module:NumberSpell - Revision history
2025-05-30T11:58:09Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.3
https://en.wikipedia.org/w/index.php?title=Module:NumberSpell&diff=592785612&oldid=prev
Mr. Stradivarius: Protected Module:NumberSpell: High-risk Lua module: used in Module:TimeAgo ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
2014-01-28T12:43:00Z
<p>Protected Module:NumberSpell: <a href="/wiki/Wikipedia:Lua/Modules" title="Wikipedia:Lua/Modules">High-risk Lua module</a>: used in <a href="/w/index.php?title=Module:TimeAgo&action=edit&redlink=1" class="new" title="Module:TimeAgo (page does not exist)">Module:TimeAgo</a> ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:43, 28 January 2014</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Mr. Stradivarius
https://en.wikipedia.org/w/index.php?title=Module:NumberSpell&diff=590556735&oldid=prev
Mr. Stradivarius: Mr. Stradivarius moved page Module:NumberWrite to Module:NumberSpell without leaving a redirect: snappier name
2014-01-13T19:58:19Z
<p>Mr. Stradivarius moved page <a href="/w/index.php?title=Module:NumberWrite&action=edit&redlink=1" class="new" title="Module:NumberWrite (page does not exist)">Module:NumberWrite</a> to <a href="/wiki/Module:NumberSpell" title="Module:NumberSpell">Module:NumberSpell</a> without leaving a redirect: snappier name</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:58, 13 January 2014</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Mr. Stradivarius
https://en.wikipedia.org/w/index.php?title=Module:NumberSpell&diff=590551550&oldid=prev
Mr. Stradivarius: add 100, because why not?
2014-01-13T19:23:16Z
<p>add 100, because why not?</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:23, 13 January 2014</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 6:</td>
<td colspan="2" class="diff-lineno">Line 6:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local p = {}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local p = {}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>local max = <del style="font-weight: bold; text-decoration: none;">99</del> -- The maximum number that can be parsed.</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>local max = <ins style="font-weight: bold; text-decoration: none;">100</ins> -- The maximum number that can be parsed.</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local ones = {</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local ones = {</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 35:</td>
<td colspan="2" class="diff-lineno">Line 35:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> [70] = 'seventy',</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> [70] = 'seventy',</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> [80] = 'eighty',</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> [80] = 'eighty',</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> [90] = 'ninety'</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> [90] = 'ninety'<ins style="font-weight: bold; text-decoration: none;">,</ins></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> [100] = 'one hundred'</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
</table>
Mr. Stradivarius
https://en.wikipedia.org/w/index.php?title=Module:NumberSpell&diff=590549377&oldid=prev
Mr. Stradivarius: create a module that converts numbers into their written English form - can cope with numbers from 0 to 99
2014-01-13T19:09:00Z
<p>create a module that converts numbers into their written English form - can cope with numbers from 0 to 99</p>
<p><b>New page</b></p><div>-- This module converts a number into its written English form.<br />
-- For example, "2" becomes "two", and "79" becomes "seventy-nine".<br />
<br />
local getArgs = require('Module:Arguments').getArgs<br />
<br />
local p = {}<br />
<br />
local max = 99 -- The maximum number that can be parsed.<br />
<br />
local ones = {<br />
[0] = 'zero',<br />
[1] = 'one',<br />
[2] = 'two',<br />
[3] = 'three',<br />
[4] = 'four',<br />
[5] = 'five',<br />
[6] = 'six',<br />
[7] = 'seven',<br />
[8] = 'eight',<br />
[9] = 'nine'<br />
}<br />
<br />
local specials = {<br />
[10] = 'ten',<br />
[11] = 'eleven',<br />
[12] = 'twelve',<br />
[13] = 'thirteen',<br />
[15] = 'fifteen',<br />
[18] = 'eighteen',<br />
[20] = 'twenty',<br />
[30] = 'thirty',<br />
[40] = 'forty',<br />
[50] = 'fifty',<br />
[60] = 'sixty',<br />
[70] = 'seventy',<br />
[80] = 'eighty',<br />
[90] = 'ninety'<br />
}<br />
<br />
local formatRules = {<br />
{num = 90, rule = 'ninety-%s'},<br />
{num = 80, rule = 'eighty-%s'},<br />
{num = 70, rule = 'seventy-%s'},<br />
{num = 60, rule = 'sixty-%s'},<br />
{num = 50, rule = 'fifty-%s'},<br />
{num = 40, rule = 'forty-%s'},<br />
{num = 30, rule = 'thirty-%s'},<br />
{num = 20, rule = 'twenty-%s'},<br />
{num = 10, rule = '%steen'}<br />
}<br />
<br />
function p.main(frame)<br />
local args = getArgs(frame)<br />
local num = tonumber(args[1])<br />
local success, result = pcall(p._main, num)<br />
if success then<br />
return result<br />
else<br />
return string.format('<strong class="error">Error: %s</strong>', result) -- "result" is the error message.<br />
end<br />
return p._main(num)<br />
end<br />
<br />
function p._main(num)<br />
if type(num) ~= 'number' or math.floor(num) ~= num or num < 0 or num > max then<br />
error('input must be an integer between 0 and ' .. tostring(max), 2)<br />
end<br />
-- Check for numbers from 0 to 9.<br />
local onesVal = ones[num]<br />
if onesVal then<br />
return onesVal<br />
end<br />
-- Check for special numbers.<br />
local specialVal = specials[num]<br />
if specialVal then<br />
return specialVal<br />
end<br />
-- Construct the number from its format rule.<br />
onesVal = ones[num % 10]<br />
if not onesVal then<br />
error('Unexpected error parsing input ' .. tostring(num))<br />
end<br />
for i, t in ipairs(formatRules) do<br />
if num >= t.num then<br />
return string.format(t.rule, onesVal)<br />
end<br />
end<br />
error('No format rule found for input ' .. tostring(num))<br />
end<br />
<br />
return p</div>
Mr. Stradivarius