Module:Chemistry Lookup: Difference between revisions

From Space Station 14 Wiki
m (Moony moved page Module:Prototype Lookup to Module:Chemistry Lookup without leaving a redirect)
No edit summary
Line 1: Line 1:
local prototypes = mw.loadData("Module:Prototype Lookup/data")
local prototypes = mw.loadData("Module:Chemistry Lookup/data")


local p = {}
local p = {}

Revision as of 05:05, 18 December 2021

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

local prototypes = mw.loadData("Module:Chemistry 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 = ""
	local group = frame.args[1]
	for k in pairs(prototypes) do
		if prototypes[k].group == group then
			out = out .. frame:expandTemplate{ title = "Chembox", args = { prototype = k }}
		end
	end
	return out
end

return p