Module:Item Products: Difference between revisions
From Guinea Isles Wiki
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
local recipes = require('Module:Recipes') | |||
local p = {} | local p = {} | ||
function p._main(args) | function p._main(args) | ||
-- Get recipe data | |||
local item_id = nil | local item_id = nil | ||
if args["id"] ~= nil then | if args["id"] ~= nil then | ||
| Line 9: | Line 12: | ||
end | end | ||
if item_id == nil then | |||
return "Error: No item id found" | |||
end | |||
local products = recipes.get_item_products(item_id) | |||
if products == nil then | |||
return "Error: Unable to find id " .. item_id .. " in recipes through get_item_products!" | |||
end | |||
if products == {} then | |||
return "No products found for id " .. item_id .. " in recipes through get_item_products." | |||
end | |||
-- Iterate over data, creating a wikitable | |||
-- Render | |||
return item_id | return item_id | ||
end | end | ||
Revision as of 16:54, 20 September 2025
Documentation for this module may be created at Module:Item Products/doc
local recipes = require('Module:Recipes')
local p = {}
function p._main(args)
-- Get recipe data
local item_id = nil
if args["id"] ~= nil then
item_id = args["id"]
else
item_id = mw.title.getCurrentTitle().text
end
if item_id == nil then
return "Error: No item id found"
end
local products = recipes.get_item_products(item_id)
if products == nil then
return "Error: Unable to find id " .. item_id .. " in recipes through get_item_products!"
end
if products == {} then
return "No products found for id " .. item_id .. " in recipes through get_item_products."
end
-- Iterate over data, creating a wikitable
-- Render
return item_id
end
function p.main(frame)
local args = frame:getParent().args
return p._main(args)
end
return p