Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Search
Search
Appearance
Create account
Log in
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Editing
Module
:
Exponential search/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
== Examples == === Jimbo's talk archives === [[User talk:Jimbo Wales]] has archives at [[User talk:Jimbo Wales/Archive 1]], [[User talk:Jimbo Wales/Archive 2]], ... To find the highest archive number, you would use code like this: <syntaxhighlight lang="lua"> local expSearch = require('Module:Exponential search') local highestArchive = expSearch(function (i) local archive = 'User talk:Jimbo Wales/Archive ' .. i return mw.title.new(archive).exists end) </syntaxhighlight> === Village pump archives === [[Wikipedia:Village pump (proposals)]] has old archives at [[Wikipedia:Village pump (proposals)/Archive A]], [[Wikipedia:Village pump (proposals)/Archive B]], etc. After they go through to Archive Z, the next archive is Archive AA. Although these archives aren't being updated anymore, as a demonstration we can find the highest one using this module; all we need is a function that converts from an integer to the corresponding archive name. <syntaxhighlight lang="lua"> local expSearch = require('Module:Exponential search') local function integerToAlpha(i) -- This function converts 1 to A, 2 to B, ... 26 to Z, 27 to AA, ... local ret = '' while i > 0 do local rem = i % 26 if rem == 0 then rem = 26 end local char = string.char(rem + 64) -- the "rem"th letter of the alphabet ret = char .. ret i = (i - rem) / 26 end return ret end local function integerToArchive(i) return 'Wikipedia:Village pump (proposals)/Archive ' .. integerToAlpha(i) end local highestInteger = expSearch(function (i) local archive = integerToArchive(i) return mw.title.new(archive).exists end) local highestArchive = integerToArchive(highestInteger) </syntaxhighlight> <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly><noinclude> [[Category:Module documentation pages]] </noinclude>
Summary:
Please note that all contributions to LarpOfHoi4 Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LarpOfHoi4 Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, 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.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Module
:
Exponential search/doc
(section)
Add topic