Module:ListFoods

local p = {} local cargo = mw.ext.cargo

-- Print the list of all foods in the game. (based on Special:CargoTables/item and Special:CargoTables/item_metadata) -- Usage: function p.ListAllFoods -- Perform a SQL query to the Cargo database. local tables = 'item' local fields = 'wikiPage,description,category,rarity,price,stackSize,id' local queryOpt = { where = 'category IN ("food", "preparedFood", "drink", "medicine")', limit = 5000, orderBy = 'name' }	local rows = cargo.query( tables, fields, queryOpt ) or {}

-- Show a table of all sets. -- Resistances must be in the same order as displayed in-game. local ret = '{| class="wikitable sortable"\n' .. '|-\n! Item !! Description !! Category !! Rarity !! Price !! Stack size\n'

for _, row in ipairs( rows ) do ret = ret .. '|-\n' .. '||' .. row.wikiPage .. '||\n' .. row.description .. '\n' .. '||' .. row.category .. '||' .. row.rarity .. '||' .. row.price .. '||' .. row.stackSize .. '\n' end

ret = ret .. '\n|}' return ret end

return p