Module:Album image: Difference between revisions

From SPCodex, The Smashing Pumpkins wiki
(Created page with "local p = {} function p._albumImage(title) local cargo = mw.ext.cargo local results = cargo.query( 'albums', 'cover', { where = 'name = "' .. title .. '"' } ) for...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}


function p._albumImage(title)
function p._main(title)
if title == nil or title == '' then
return ''
end
local cargo = mw.ext.cargo
local cargo = mw.ext.cargo
local results = cargo.query(
local results = cargo.query(
Line 13: Line 16:
return result['cover']
return result['cover']
end
end
end
function p.main(frame)
return p._main(frame.args[1])
end
end


return p
return p

Latest revision as of 23:18, 29 July 2023

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

local p = {}

function p._main(title)
	if title == nil or title == '' then
		return ''
	end
	local cargo = mw.ext.cargo
	local results = cargo.query(
		'albums',
		'cover',
		{ where = 'name = "' .. title .. '"' }
	)
	
	for r = 1, #results do
		local result = results[r]
		return result['cover']
	end
end

function p.main(frame)
	return p._main(frame.args[1])
end

return p