Difference between revisions of "Module:Sandbox/Andy M. Wang"
Jump to navigation
Jump to search
blackwiki>Andy M. Wang m (concat) |
blackwiki>Andy M. Wang (skip first) |
||
| Line 10: | Line 10: | ||
for k, v in pairs(args) do | for k, v in pairs(args) do | ||
if type(k) == 'number' then | if type(k) == 'number' then | ||
| − | pages[k] = v | + | if k ~= 1 then |
| + | pages[k - 1] = v | ||
| + | end | ||
end | end | ||
end | end | ||
| Line 17: | Line 19: | ||
function p._for(titleText, ...) | function p._for(titleText, ...) | ||
| − | + | local links = mHatnote.formatPages(...) | |
| − | + | links = mw.text.listToText(links) | |
| − | + | local text = 'For ' .. links | |
| − | + | return mHatnote._hatnote(text) | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
end | end | ||
| − | |||
| − | |||
Revision as of 06:32, 1 May 2016
local mHatnote = require('Module:Hatnote')
local mArguments -- lazily initialise
local p = {}
function p.forfun(frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame, {parentOnly = true})
local pages = {}
for k, v in pairs(args) do
if type(k) == 'number' then
if k ~= 1 then
pages[k - 1] = v
end
end
end
return p._for(mw.title.getCurrentTitle().text, unpack(pages))
end
function p._for(titleText, ...)
local links = mHatnote.formatPages(...)
links = mw.text.listToText(links)
local text = 'For ' .. links
return mHatnote._hatnote(text)
end