Module:Recipes

From Guinea Isles Wiki
Revision as of 14:45, 20 September 2025 by Squeaky (talk | contribs)

Module:Recipes is a module designed around managing the data of in-game recipes of all kinds. It allows users to query Module:Recipes/data.json, which contains this information in JSON format.

Functions


--------------------------
-- Module for crafting recipe data
------------------------
local data = mw.loadJsonData('Module:Recipes/data.json')

local p = {}

function p.get_recipe(frame)
	local args = frame:getParent().args
	
	local output_id = nil
	if args["output_id"] ~= nil then
		output_id = args["output_id"]
	else
		output_id = mw.title.getCurrentTitle()
	end
	
	if data[output_id] ~= nil then
		return data[output_id]
	end
	
	return "No recipe found with id " .. tostring(output_id)
end

return p