Module:Songs: Difference between revisions
Jump to navigation
Jump to search
no edit summary
No edit summary |
No edit summary |
||
Line 52: | Line 52: | ||
end | end | ||
function p.songs(frame) | |||
local horseName = mw.text.decode(frame.args[1]) | |||
if not horseName then return end | |||
local escaped = string.gsub(horseName, "'", "\\'") | |||
local query = 'SELECT song_title, album FROM Album_Songs WHERE singers HOLDS "' .. escaped .. '"' | |||
local results = cargo.query(query) | |||
local table = '{| class="wikitable sortable mw-collapsible"\n! Song !! Album\n' | |||
for _, row in ipairs(results) do | |||
table = table .. '|-\n| ' .. row.song_title .. ' || ' .. row.album .. '\n' | |||
end | |||
table = table .. '|}' | |||
return table | |||
end | |||
return p | return p |