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, "{{item|([%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", "Held Items", "Scarves", "Cosmetic Items", "Ability Items", "Type-enhancing Items", "Family Items", "Music Items", "Evolutionary Items", "Keys", "Consumable Items", "Berries", "Seeds", "Gummis", "Miscellaneous Items", "Throwing Items", "Valuable Items", "TMs and HMs", "Traps#Usable Traps", "Orbs", "Tutor Items", "Fossils", "Boxes", "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, "{{item|([%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)