Module:Decoration recipes

local recipes = {}

--Creates table where excluded deco is the key and 'true' is the value function Set (list) local set = {} for _, v in pairs(list) do       set[v] = true end return set end

function recipes.craft(frame) local name = frame.args["header"] local biome = frame.args["biome"] --Set header to biome if header is not found if name == nil or name == '' then name = biome end local result = '{| class="craftbox mw-collapsible mw-collapsed" style="-moz-border-radius: .7em; -webkit-border-radius: .7em; padding: 0.2em; margin-bottom:5px;" border="1"\n! colspan="7" style="background-color: #0f8687; color: #ffffff; font-size:110%; padding:0.2em; width:100em;" |' .. name .. '\n|-\n' local recipeList = mw.loadData('Module:Decoration_recipes/' .. biome) --Check if it should load decorational or framework data if frame.args["type"] == 'Framework' then recipeList = mw.loadData('Module:Decoration_recipes/' .. biome .. '/Framework') end --Creates recipe table local isExcluded = Set(mw.loadData('Module:Decoration_recipes/' .. biome .. '/Exclude')) local amount = 0 for i,v in pairs(recipeList) do       --Check if type is equal to 'Recipe' and if a value should be excluded if frame.args["type"] == 'Recipe' and isExcluded[v] then else result = result .. '| style="text-align:center;width:14%;"|' .. frame:expandTemplate{title='Linked icon', args={v}} .. ' ' .. v .. '\n' amount = amount + 1 --Adds new row every 7 entries if amount%7 == 0 then result = result .. '|-\n' end end end

result = result .. '|}'

return result

end

return recipes