Module:Test

local i18n = { Id = 'ID', Name = 'Name', Image = 'Image', InternalName = 'Internal name', Deprecated = '(Deprecated)', }

local data={} local isInSet = require('Module:Iteminfo/idSets').getValue

return { main=function(frame) -- There are more than 5000 items now. local result = mw.ext.cargo.query(		'Items_new',		'_pageName=page, itemid, name, imagefile, internalname',		{			groupBy = 'itemid',			where = 'itemid IS NOT NULL AND itemid <=4000 AND internalname <> ""',			limit = 5000		}	) for _, row in ipairs(result) do		data[row.itemid] = row end local result = mw.ext.cargo.query(		'Items_new',		'_pageName=page, itemid, name, imagefile, internalname',		{			groupBy = 'itemid',			where = 'itemid IS NOT NULL AND itemid > 4000 AND internalname <> ""',			limit = 5000		}	) for _, row in ipairs(result) do		data[row.itemid] = row end

local output = '' local unused = require('Module:Iteminfo/idSets').getIdSet('Deprecated') for itemid = 1, 5042 do		if unused[itemid] then output = output .. ' '..itemid..' ..i18n.Deprecated.. ' elseif data[itemid] then output = output .. ' '..itemid..'  '..(row.page==row.name) and (..row.name..) or (..row.name..)..'      ' else local iteminfo = require('Module:Iteminfo').getItemInfo(itemid) output = output .. ' '..itemid..' (*)  '..iteminfo.name..'      ' end end return output end, }