Module:Chemistry Lookup

From Space Station 14 Wiki
Revision as of 01:47, 18 December 2021 by Moony (talk | contribs)

Documentation for this module may be created at Module:Chemistry Lookup/doc

local prototypes = mw.loadData("Module:Prototype Lookup/data")

local p = {}
p.prototypes = prototypes

function p.readscalar(frame)
	return mw.text.nowiki(prototypes[frame.args[1]][frame.args[2]])
end

function p.hasrecipe(frame)
	return prototypes[frame.args[1]]["recipes"] ~= nil
end

function p.buildboxes(frame)
	local out = ""
	for k in pairs(prototypes) do
		out = out .. frame:expandTemplate{ title = "Chembox", args = { prototype = k }}
	end
	return out
end

return p