Module:Songs

Revision as of 00:37, 17 April 2024 by Snep (talk | contribs) (Created page with "local p = {} local cargo = mw.ext.cargo function p.events(frame) local songName = frame.args[1] if not songName then return end local escaped = string.gsub(songName, "'", "\'") local query = { where = "song_page='" .. escaped .. "'", } local fields = {'event_page', 'leg_name', 'day', 'cast'} local events = cargo.query('Setlist_Songs', table.concat(fields, ','), query) local text = '' for _, ev in ipairs(events) do text = text .. frame:expandTemplate{...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Songs/doc

local p = {}
local cargo = mw.ext.cargo

function p.events(frame)
	local songName = frame.args[1]
	if not songName then return end
	local escaped = string.gsub(songName, "'", "\'")
	local query = {
		where = "song_page='" .. escaped .. "'",
	}
	local fields = {'event_page', 'leg_name', 'day', 'cast'}
	local events = cargo.query('Setlist_Songs',
		table.concat(fields, ','), query)

	local text = ''
	for _, ev in ipairs(events) do
		text = text .. frame:expandTemplate{
			title='Song Events/Entry',
			args=ev
		} .. '\n'
	end
	return template
end

return p