Module:Shortcut: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
allow output if no shortcuts are set but msg is present
(fix error message)
(allow output if no shortcuts are set but msg is present)
Line 17:
local nShortcuts = #shortcuts
 
-- Check that we have something to display
-- Validate shortcuts
if nShortcuts < 1 and not options.msg then
return nil
end
else
 
for i, shortcut in ipairs(shortcuts) do
-- Validate shortcuts
if type(shortcut) ~= 'string' or #shortcut < 1 then
for i, shortcut in ipairs(shortcuts) do
error(string.format(
'if type(shortcut) #%d~= was'string' invalidor (shortcuts#shortcut must< be strings of '1 ..then
error(string.format(
'at least one character in length)'
'shortcut #%d was invalid (shortcuts must be strings of ' ..
), 2)
'at least one character in length)'
end
), 2)
end
end
Line 82 ⟶ 83:
 
-- Error category
if shortcuts[1] then
do
local title = mw.title.new(shortcuts[1])
if not title or not title.exists then
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu