Module:NewDecoPage/Workbench

local test = {}

function test.k(frame) local itemSet = 'middle left right' local result = 'I like pie' local pageName = 'Dragon Seat - Middle Section' if (itemSet ~= nil and itemSet ~= '') then result = result .. '. This item can be paired with the ' local pair = {} local count = 0 local base = '' for s in string.gmatch(itemSet, "%S+") do           if true then pair[#pair+1] = s           else count = count + 1 base =  .. string.lower(s):gsub("^%l", string.upper) ..  end end if #pair ~= 2 then result = result .. table.concat(pair, ", "):gsub("%s[^,]*$", ' and ' .. pair[#pair]) else result = result .. string.gsub(pageName, base, pair[1]) .. ' and ' .. string.gsub(pageName, base, pair[2]) end end return table.concat(pair, ", ") end return test