Module:Test

local data = mw.loadData( 'Module:iteminfo/database' ) -- loading data table. (What a hell!)

local trim = mw.text.trim

-- cache local currentFrame

local getArg = function(key) local value = currentFrame.args[key] if not value then return nil end value = trim(value) if value == '' then return nil else return value end end

---

local p = { a = function(itemid) return mw.dumpObject(data[itemid]) end, test = function (frame) currentFrame = frame -- cache local min = tonumber(getArg(1)) or 0 local max = tonumber(getArg(2)) or 0 local output = '' for itemid = min, max do			local t = mw.dumpObject(data[itemid]) t = string.gsub(t, "table#1 ", "") t = string.gsub(t, "metatable = table#2", "") t = string.gsub(t, " +", "") t = string.gsub(t, "\n+", "\n") output = output .. '\n[' .. itemid .. '] = ' .. t .. ',\n' end return output end, getInfo = function (frame) currentFrame = frame -- cache

local itemid = tonumber(getArg('id')) or 0 local prefix = getArg('prefix') or '_iteminfo_'

if itemid >= 3930 or itemid <= 0 then itemid = 0 end local result = data[itemid]

local args = {} for k,v in pairs(result) do table.insert(args, prefix .. k)			table.insert(args, v)		end

frame:callParserFunction{ name = '#dplvar:set', args = args } end,

}

p.getinfo = p.getInfo p.GetInfo = p.getInfo

return p