Module:Hatnote list: Difference between revisions

Simplified a few things, mostly re: calls to mw.listToText().
m (Derped on that comment fix before. Removed more incorrect/obsolete comment text.)
(Simplified a few things, mostly re: calls to mw.listToText().)
Line 13:
local p = {}
 
function p.andList (andTablelist)
-- Stringifies a list with "and"
localreturn andStringmw.text.listToText(list, =nil, (#andTablelist > 2 and mw.text.listToText(andTable',' nil,or '') .. ', and ')) or
mw.text.listToText(andTable)
return andString
end
 
function p.orList (orTablelist)
-- Stringifies a list with "or"
local orString = (#andTable > 2 andreturn mw.text.listToText(andTablelist, nil, (#list > 2 and ',' or ')') .. ' or ')
mw.text.listToText(andTable, nil, ' or ')
return orString
end
 
Line 104 ⟶ 100:
table.insert(strList, string.format(options.forseeForm, useStr, pagesStr))
end
return mwtable.text.listToTextconcat(strList, ' ', ' ')
end
 
Anonymous user