Module:ItemSources: Difference between revisions

Jump to navigation Jump to search
343 bytes added ,  12:46, 4 April 2022
no edit summary
No edit summary
No edit summary
 
(12 intermediate revisions by the same user not shown)
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
local args = frame:getParent().args
mw.log("args", inspect(data))
local storeList


local status, message = pcall(function()
local status, data = pcall(function()
storeList = storeLocationsList.main(frame)
storeLocationsList.main(frame)
end)
end)


mw.log("status", status)
mw.log("data", data)


if data then
if status then
mw.log("no error")
-- No error, continue as usual
else
 
mw.log("error")
local itemSourcesTitle = mw.html.create("h2")
mw.log("data", inspect(data))
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
end
end






return p
return p

Navigation menu