Module:HeroDataArrays
Overview
This module consists of one generic function, heroDataArray, and a series of functions that create specific wikitables using the output from heroDataArray.
local allHeroData = mw.loadJsonData("Data:HeroData.json")
local inGameHeroData = {}
for heroKey, heroData in pairs(allHeroData) do
if heroData["IsDisabled"] == false and heroData["InDevelopment"] == false then
table.insert(inGameHeroData, heroData)
end
end
local p = {}
p.heroDataArray = function(frame)
local outData = {}
for i, heroData in ipairs(inGameHeroData) do
local out = {}
for j, keyPath in pairs(frame.args) do
if type(keyPath)=="table" then
local node = heroData
for k, key in pairs(keyPath) do
node = node[key]
end
out[table.concat(keyPath,"")] = node
else
out[keyPath] = heroData[keyPath]
end
end
outData[heroData["Name"]] = out
end
return(outData)
end
--=p.heroDataArray{args={"Name", "MaxHealth", "{LevelScaling, Health}"}}
return p