Module:ItemsByStat
Documentation for this module may be created at Module:ItemsByStat/doc
local p = {}
local data = mw.loadJsonData("Data:ItemData.json")
local selectByStat = function(stat)
local Item,Value = {},{}
local i = 1
for m,v in pairs(data) do
for n,w in pairs(v) do
if n == stat then
Item[i] = v["Name"]
Value[i] = v[stat]
i = i+1
break
end
end
end
local b = {Item, Value}
return b
end
p.tablefy = function(frame)
local stat = frame.args[1]
local tabledata = selectByStat(stat)
output = ""
for i,x in pairs(tabledata) do
output = output.."Name: "..x[1][1].."\n"
end
return output
end
return p