Module:Iteminfo

local data = mw.loadData( 'Module:Iteminfo/data' ) -- 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 getStats = function(itemid) local result = defaultStats if not data[itemid] then return result end result = setStats(result, data[itemid]) result = postProcess(result, itemid) result['valid'] = 1 return result end

---

local p = { getInfo = function (frame) currentFrame = frame -- cache

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

local result = getStats(itemid)

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

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

getStats = getStats }

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

return p