Module:ItemSources: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
-------------------------- | -------------------------- | ||
-- Module for [[Template:ItemSources]] | -- Module for [[Template:ItemSources]] | ||
-- | -- | ||
-- | -- | ||
------------------------ | ------------------------ | ||
local p = {} | local p = {} | ||
local storeLocationsList = require('Module:Store locations list') | local storeLocationsList = require('Module:Store locations list') | ||
local onmain = require('Module:Mainonly').on_main | local onmain = require('Module:Mainonly').on_main | ||
local commas = require('Module:Addcommas')._add | local commas = require('Module:Addcommas')._add | ||
local inspect = require('Module:Inspect') | local inspect = require('Module:Inspect') | ||
VariablesLua = mw.ext.VariablesLua | VariablesLua = mw.ext.VariablesLua | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame:getParent().args | |||
mw.log("args", inspect(data)) | |||
local storeList | |||
local status, message = pcall(function() | |||
storeList = storeLocationsList.main(frame) | |||
end) | |||
mw.log("status", status) | |||
if status then | |||
-- No error, continue as usual | |||
local div = mw.html.create("h3") | |||
div:wikitext("Shop locations") | |||
mw.log("aa", tostring(div) .. storeList) | |||
return tostring(div) .. storeList | |||
else | else | ||
error(message) | if string.find(message, 'The item .* is not sold in any shop,') then | ||
mw.log(message) | |||
else | |||
error(message) | |||
end | |||
end | end | ||
end | end | ||
return p | return p | ||
Revision as of 12:41, 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
mw.log("args", inspect(data))
local storeList
local status, message = pcall(function()
storeList = storeLocationsList.main(frame)
end)
mw.log("status", status)
if status then
-- No error, continue as usual
local div = mw.html.create("h3")
div:wikitext("Shop locations")
mw.log("aa", tostring(div) .. storeList)
return tostring(div) .. 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