Editing
Module:Highest archive number/doc
From Thetacola Wiki
Jump to navigation
Jump to search
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!
{{Module rating|protected}} This module finds the highest archive number for a given set of numbered archive pages. The only input required is the prefix of the archive set. For example, for [[Talk:France/Archive 1]], [[Talk:France/Archive 2]], etc., the prefix would be "Talk:France/Archive ". The module uses an [[exponential search]] algorithm, so it will make relatively few [[WP:EXPENSIVE|expensive function calls]] even for large numbers of archives. (The expensive function call is necessary to determine whether an individual archive exists.) For 1-10 archive pages, the module typically uses 4-6 expensive function calls; for 20-100 archives, it uses 6-12 calls; and for hundreds of archives, it uses 12-20 calls. Because the module uses an exponential search, no gaps are allowed in the archive numbers; if there are any gaps, then the module may return the number of any archive page that exists where the following archive page does not exist. However, archive numbers do not have to start at 1; if they start at a higher number, you can specify this number in the <code>start</code> parameter. == Usage == === From wikitext === From wikitext this module is usually used via the {{tl|highest archive number}} template. However, it is also possible to use it directly from invoke with the syntax <code><nowiki>{{#invoke:highest archive number|main|</nowiki>''prefix''<nowiki>|start=</nowiki>''start''<nowiki>}}</nowiki></code>. === From Lua === Load the module with the following code: <syntaxhighlight lang="lua"> local mHAN = require('Module:Highest archive number') </syntaxhighlight> You can then use it like this: <syntaxhighlight lang="lua"> mHAN._main(prefix, start) </syntaxhighlight> The <var>prefix</var> variable is the prefix of the archive set. == Examples == {| class="wikitable" ! #invoke code ! Lua code ! Result |- | <code><nowiki>{{#invoke:highest archive number|main|Wikipedia:Administrators' noticeboard/IncidentArchive}}</nowiki></code> | {{code|mHAN._main("Wikipedia:Administrators' noticeboard/IncidentArchive")|lua}} | {{#invoke:highest archive number|main|Wikipedia:Administrators' noticeboard/IncidentArchive}} |- | <code><nowiki>{{#invoke:highest archive number|main|Talk:Byzantine Empire/Archive }}</nowiki></code> | {{code|mHAN._main("Talk:Byzantine Empire/Archive ")|lua}} | {{#invoke:highest archive number|main|Talk:Byzantine Empire/Archive }} |- | <code><nowiki>{{#invoke:highest archive number|main|Wikipedia talk:WikiProject Chemicals/Archive |start=2005}}</nowiki></code> | {{code|mHAN._main("Wikipedia talk:WikiProject Chemicals/Archive ", 2005)|lua}} | {{#invoke:highest archive number|main|Wikipedia talk:WikiProject Chemicals/Archive |start=2005}} |} <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| <!-- Categories go here and interwikis go in Wikidata. --> }}</includeonly>
Summary:
Please note that all contributions to Thetacola Wiki 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
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Code
(
edit
)
Template:Module rating
(
edit
)
Template:Template link
(
edit
)
Template:Tl
(
edit
)
Module:Arguments
(
edit
)
Module:Exponential search
(
edit
)
Module:Highest archive number
(
edit
)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information