Module:Shortcut: Difference between revisions
From Test Wiki
Content deleted Content added
fix error message |
allow output if no shortcuts are set but msg is present |
||
| Line 17: | Line 17: | ||
local nShortcuts = #shortcuts |
local nShortcuts = #shortcuts |
||
-- Check that we have something to display |
|||
| ⚫ | |||
if nShortcuts < 1 then |
if nShortcuts < 1 and not options.msg then |
||
return nil |
return nil |
||
| ⚫ | |||
else |
|||
| ⚫ | |||
| ⚫ | |||
if type(shortcut) ~= 'string' or #shortcut < 1 then |
|||
| ⚫ | |||
| ⚫ | |||
if type(shortcut) ~= 'string' or #shortcut < 1 then |
|||
| ⚫ | |||
| ⚫ | |||
'shortcut #%d was invalid (shortcuts must be strings of ' .. |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
end |
end |
||
end |
end |
||
| Line 82: | Line 83: | ||
-- Error category |
-- Error category |
||
if shortcuts[1] then |
|||
do |
|||
local title = mw.title.new(shortcuts[1]) |
local title = mw.title.new(shortcuts[1]) |
||
if not title or not title.exists then |
if not title or not title.exists then |
||