Anonymous user
Module:Section link: Difference between revisions
actually, just make the sections optional
(fix error placement and tweak default conjunction) |
(actually, just make the sections optional) |
||
Line 15:
checkType('_main', 1, page, 'string', true)
checkType('_main', 3, options, 'table', true)
if
elseif type(sections) == 'string' then
sections = {sections}
elseif type(sections) ~= 'table' then
error(string.format(
"type error in argument #2 to '_main'
"(string, table or nil expected, got %s)",
type(sections)
), 2)
Line 28 ⟶ 31:
-- Make the link(s).
local isShowingPage = not options.nopage
if #sections
local linkPage = page or ''
local section = sections[1] or 'Notes'
Line 38 ⟶ 41:
return makeSectionLink(linkPage, section, display)
else
-- Multiple sections. First,
▲ if #sections < 1 then
local ret = {}
for i, section in ipairs(sections) do
|