Module:Sandbox

local p = {}

function split(str, pattern) local out = {} local i = 1

local split_start, split_end = string.find(str, pattern, i)   while split_start do        out[#out+1] = string.sub(str, i, split_start - 1) i = split_end + 1 split_start, split_end = string.find(str, pattern, i)   end out[#out+1] = string.sub(str, i)   return out end

function p.outputVillagerfromList (frame) local data = frame.args[1] local villagerTable = split( data, "," ) local villager = "" local villagerList = "" local mainVillager = "" local villagerOutput = "" local argument = "Villager" for k, villa in ipairs(villagerTable) do       villager = frame:expandTemplate{ title = "Availability", args = { argument, villa } } villagerList = villagerList .. villager end

local root = mw.html.create root:wikitext(villagerList) return root end return p