Module:RecentMusicVideos

local p = {}

L = {} A = {} T = {}

n_items = 0

function DataInsert(link, artist, title) table.insert(L, link) table.insert(A, artist) table.insert(T, title) n_items = n_items + 1 end

pattern = [[{| style="text-align:center;" align="center"
 * video1
 * video2
 * video3
 * description1
 * description2
 * description3
 * video4
 * video5
 * video6
 * description4
 * description5
 * description6
 * }]]
 * description5
 * description6
 * }]]

function BuildOutput(frame) output = pattern for i = 1,6,1 do id = "9j7mDS5vn9Y" width = "220" height = "150" artist = "Artist" title = "Title" video = frame:expandTemplate{ title = "YoutubePlayer", args = {id=id, width=width, height=height} }		description = "" .. artist .. " - [https://www.youtube.com/watch?v=" .. id .. " " .. title .. "]"		videoplaceholder = "video" .. i descriptionplaceholder = "description" .. i		output = output:gsub(videoplaceholder, video) output = output:gsub(descriptionplaceholder, description) end

return output end

function p.Main(frame) return BuildOutput(frame) end

return p