67 279
contributi
(SMW Description) |
(SeasonsQty) |
||
Riga 1: | Riga 1: | ||
-- Keyword: wikitrek | -- Keyword: wikitrek | ||
local p = {} | local p = {} | ||
local QFromP = require('Modulo:DTGenerico').QFromP | |||
function p.TypeFromDT(frame) | function p.TypeFromDT(frame) | ||
local Item | local Item | ||
Riga 48: | Riga 51: | ||
return string.char(10) .. AllLabels | return string.char(10) .. AllLabels | ||
end | |||
--- Function to calculate the number of seasons of a series | |||
-- | |||
-- @param ShortName The short name of the series as in P24 | |||
-- @return Integer Number of seasons | |||
function p.SeasonsQty(ShortName) | |||
local QueryResult | |||
-- {{#ask: [[Istanza::Episodio di Discovery]]|?Stagione|format=max}} | |||
QueryResult = mw.smw.getQueryResult('[[Istanza::Episodio di ' .. ShortName .. ']]|?Stagione|format=max') | |||
if QueryResult == nil or QueryResult < 0 then | |||
return 0 | |||
else | |||
return QueryResult | |||
end | |||
end | end | ||
return p | return p |