Module:ItemsByStat: Difference between revisions
Jump to navigation
Jump to search
SerpentofSet (talk | contribs) mNo edit summary |
SerpentofSet (talk | contribs) mNo edit summary |
||
Line 26: | Line 26: | ||
local tableData = selectByStat(stat) | local tableData = selectByStat(stat) | ||
local outString = "" | local outString = "" | ||
return(tableData[ | return(tableData[2][1]) | ||
-- for i=1,#tableData[1] do | -- for i=1,#tableData[1] do | ||
-- outString = outString.."Name: [["..tableData[1][i].."]] Increased Weapon Damage: "..tableData[3][i].."\n\n" | -- outString = outString.."Name: [["..tableData[1][i].."]] Increased Weapon Damage: "..tableData[3][i].."\n\n" |
Revision as of 14:41, 27 September 2024
Documentation for this module may be created at Module:ItemsByStat/doc
local p = {}
local AllItemData = mw.loadJsonData("Data:ItemData.json")
local selectByStat = function(stat)
local Name,Tier,Value = {},{},{}
local outData = {Name,Tier,Value}
local inKeys = {"Name","Tier",stat};
local i = 1
for m,itemData in pairs(AllItemData) do
for itemFieldName,n in pairs(itemData) do
if itemFieldName == stat then
for x = 1,3 do
outData[x][i] = itemData[inKeys[x]]
i = i+1;
end
break
end
end
end
return outData
end
p.tablefy = function(frame)
local stat = frame.args[1]
local tableData = selectByStat(stat)
local outString = ""
return(tableData[2][1])
-- for i=1,#tableData[1] do
-- outString = outString.."Name: [["..tableData[1][i].."]] Increased Weapon Damage: "..tableData[3][i].."\n\n"
-- end
-- return outString
end
return p