Anonymous user
Module:For: Difference between revisions
Fixed bad handling of nil in "unusual parameters" check
m (1 revision imported) |
(Fixed bad handling of nil in "unusual parameters" check) |
||
Line 1:
local mArguments --initialize lazily
local yesno = require('Module:Yesno')▼
local mHatlist = require('Module:Hatnote list')
local mHatnote = require('Module:Hatnote')
local p = {}
Line 15:
function p._For (args)
local use = args[1]
if (not use) then
local category = ''▼
return mHatnote.makeWikitextError(
'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
'Template:For#Errors',
category = '[[Category:Hatnote templates using unusual parameters]]'▼
args.category
)
end
local pages = {}
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
for k, v in two(ipairs(args)) do table.insert(pages, v) end
return mHatnote._hatnote(
mHatlist.forSeeTableToString({{use = use, pages = pages}}),
{selfref = args.selfref}
) ..
(use == 'other uses') and ((category == true) or (category == nil)) and
)
end
|