We are actively looking for staff to help us build the wiki. If you are interested please join our Discord server and apply.
Module:Items
Documentation for this module may be created at Module:Items/doc
-- Module:Items local p = {} function p.createItemTableRow(frame) -- Get the ingredients and header passed to the module local items = mw.text.split(frame.args[1], ',') local header = frame.args[2] -- Store the number of items local numItems = #items -- Initialize the result string local result = "" -- define the item template to be used local item_template = "{{Item | name = NAME }}" -- if the item is wrapped in brackets, remove them for i, item in ipairs(items) do items[i] = item:gsub("%[", ""):gsub("%]", "") end -- open a table to contain the items, spannin the header by the number of items result = result .. "{| class=\"wikitable\" style=\"width: 100%; text-align: center;\"\n" result = result .. "! colspan=\"" .. numItems .. "\" | " .. header .. "\n" result = result .. "|-\n" -- Iterate over the items and create an item template for each for i, item in ipairs(items) do item = mw.text.trim(item) -- Replace the NAME placeholder with the item name local item_template = item_template:gsub("NAME", item) -- Append the item template to the result string result = result .. "| " .. item_template .. "\n" end -- close the table result = result .. "|}\n" return result end return p