Module:IS

local getArgs = require('Module:Arguments').getArgs local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

-- Original IS template:  ]]

function p._main(args) local pages = mw.loadData('Module:IS/pages') --Returns a table containing a table for each item page's name and the items on them

local item = args[1] or "" --Passed argument is the name of the item who's sprite we want local link = "" --Page the sprite should link to

--Find the item name throughout the table of item pages to link a page for _,page in pairs(pages) do --Iterate each item page table in "pages" for _, i in pairs (page.items) do --Iterate its table of items if i == item then --If "item" matches link = "|link=" ..page.pagename.."" --"link" becomes the name of the page the item is listed on			end end end if mw.getCurrentFrame:callParserFunction( "filepath", "" .. item .. ".png" ) ~= "" then --Check if the sprite exists return mw.getCurrentFrame:preprocess( "" ) else return mw.getCurrentFrame:preprocess("") end end

return p

-- print(p.main)