Module:DataFetch
From Project Rebearth
Documentation for this module may be created at Module:DataFetch/doc
-- Written with ❤️ by fshark (initially, at least)
local title = mw.title.new("Module:DataFetch/data.json")
local data = title and title.exists and mw.text.jsonDecode(title:getContent())
assert(data, "Data failed to load.")
local p = {}
function p.BuildingCost(f)
local args = f.args
local name = args.name
local biome = args.biome
local resource = args.resource
if not name or not biome or not resource then
error("Missing arguments")
end
return data[name].cost.byBiome[biome][resource] or 0
end
return p