सामग्री पर जाएँ

मोड्युल:Highest archive number/doc

मैथिली विकिपिडियासँ, एक मुक्त विश्वकोश

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 a binary search algorithm, so it will make relatively few 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 a binary search, a prerequisite of its use is that all archive pages below the highest number exist; if there are any red-linked pages below the highest number, then the module may return the number of any archive page that exists where the following archive page does not exist.

From wikitext this module is usually used via the {{highest archive number}} template. However, it is also possible to use it directly from invoke with the syntax {{#invoke:highest archive number|main|prefix}}.

Load the module with the following code:

local mHAN = require('Module:Highest archive number')

You can then use it like this:

mHAN._main(prefix)

The prefix variable is the prefix of the archive set.

#invoke code Lua code Result
{{#invoke:highest archive number|main|Wikipedia:Administrators' noticeboard/IncidentArchive}} mHAN._main("Wikipedia:Administrators' noticeboard/IncidentArchive")
{{#invoke:highest archive number|main|Talk:Byzantine Empire/Archive }} mHAN._main("Talk:Byzantine Empire/Archive ")