Module:ResourceInfoboxGenerator
From Corsair Cove Official Wiki
Documentation for this module may be created at Module:ResourceInfoboxGenerator/doc
local p = {}
-- Load your data table once
local rData = mw.loadData("Module:ResourceData")
local bData = mw.loadData("Module:BuildingData")
function p.makeInfobox(frame)
local name = frame.args.name or mw.title.getCurrentTitle().text
-- Find the ruilding in the data table
local r = rData[name]
if not r then
return "No data found for '" .. tostring(name) .. "'"
end
-- Pass the data to your existing template
return frame:expandTemplate{
title = "Resource infobox",
args = {
title = r.name,
ricon_filename = r.iconFile,
category = r.category,
description = r.description,
stats_list = "* [[Warehouse]] Stack Size: " .. r.stack_size .. "\n* [[Trade Post]] Stack Value: " .. r.stack_value
}
}
end
return p


