Module:DIL

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

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

function p._main(args)

local page = args[1] or nil local items = {}

if page then --If an argument Is passed ( should be the name of an Item page ) page = mw.getCurrentFrame:preprocess('') -- "page" Is the page contents page = mw.text.decode(page) --Decoding page contents for i in string.gmatch(page, "{{ItemRow|([%w é`%-?'%.]+)") do -- Find each occurance of ItemRow on the current page table.insert(items, i) --Insert found Item In "items" table end else --Default; uses Item every page local pages = {"Currencies", "Items/Held Items", "Items/Scarves", "Items/Cosmetic Items", "Items/Ability Items", "Items/Type-enhancing Items", "Items/Family Items", "Items/Music Items", "Items/Evolutionary Items", "Items/Keys", "Items/Consumable Items", "Items/Berries", "Items/Seeds", "Items/Gummis", "Items/Miscellaneous Items", "Items/Throwing Items", "Items/Valuable Items", "Items/TMs and HMs", "Traps#Usable Traps", "Items/Orbs", "Items/Tutor Items", "Items/Fossils", "Items/Boxes", "Items/Heart Slates"} -- Put every Item page title In a table to Iterate over

for k, page in ipairs(pages) do --For each page title In the pages table page = mw.getCurrentFrame:preprocess( '' ) -- "page" Is the page contents page = mw.text.decode( page ) --Decoding page contents for i in string.gmatch( page, "{{ItemRow|([%w é`%-?'%.]+)") do -- Find each occurance of ItemRow on the current page table.insert(items, i) --Insert found Item In "items" table end end end return table.concat( items, "\n") --Return every Item In our "items" table on a newline ( i.e. list It )

end return p

-- print(p.main)