Module:ItemSources: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 14: | Line 14: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local storeList | local storeList | ||
local status, message = pcall(function() | local status, message = pcall(function() | ||
storeList = storeLocationsList.main(frame) | storeList = storeLocationsList.main(frame) | ||
end) | end) | ||
Line 29: | Line 24: | ||
-- No error, continue as usual | -- No error, continue as usual | ||
local | local itemSourcesTitle = mw.html.create("h2") | ||
itemSourcesTitle:wikitext("Item sources") | |||
mw. | local shopLocationsTitle = mw.html.create("h3") | ||
shopLocationsTitle:wikitext("Shop locations") | |||
return tostring( | return tostring(itemSourcesTitle) .. tostring(shopLocationsTitle) .. storeList | ||
else | else | ||
if string.find(message, 'The item .* is not sold in any shop,') then | if string.find(message, 'The item .* is not sold in any shop,') then |
Latest revision as of 12:46, 4 April 2022
Documentation for this module may be created at Module:ItemSources/doc
-------------------------- -- Module for [[Template:ItemSources]] -- -- ------------------------ local p = {} local storeLocationsList = require('Module:Store locations list') local onmain = require('Module:Mainonly').on_main local commas = require('Module:Addcommas')._add local inspect = require('Module:Inspect') VariablesLua = mw.ext.VariablesLua function p.main(frame) local args = frame:getParent().args local storeList local status, message = pcall(function() storeList = storeLocationsList.main(frame) end) if status then -- No error, continue as usual local itemSourcesTitle = mw.html.create("h2") itemSourcesTitle:wikitext("Item sources") local shopLocationsTitle = mw.html.create("h3") shopLocationsTitle:wikitext("Shop locations") return tostring(itemSourcesTitle) .. tostring(shopLocationsTitle) .. storeList else if string.find(message, 'The item .* is not sold in any shop,') then mw.log(message) else error(message) end end end return p