Module:Video game wikidata: Difference between revisions

Content deleted Content added
Some nil protection, more to come
No edit summary
Line 48:
if(not (reference == nil or reference == "")) then
local cite = "{{cite web|url="..reference;
local timestamp = nil;
local publisher = nil;
local title = nil;
 
local timestamp =if(not (reviewscore['references'][1]['snaks']['P813'] == nil or reviewscore['references'][1]['datavaluesnaks']['valueP813']['time'1]; == nil)) then
local publisher timestamp = mw.wikibase.label('Q'..reviewscore['references'][1]['snaks']['P123P813'][1]['datavalue']['value']['numeric-idtime']);
end;
local title = reviewscore['references'][1]['snaks']['P1476'][1]['datavalue']['value']['text'];
if(not (reviewscore['references'][1]['snaks']['P123'] == nil or reviewscore['references'][1]['snaks']['P123'][1] == nil)) then
publisher = mw.wikibase.label('Q'..reviewscore['references'][1]['snaks']['P123'][1]['datavalue']['value']['numeric-id']);
end;
if(not (reviewscore['references'][1]['snaks']['P1476'] == nil or reviewscore['references'][1]['snaks']['P1476'][1] == nil)) then
local title = reviewscore['references'][1]['snaks']['P1476'][1]['datavalue']['value']['text'];
end;
 
if(not(title == nil or title == "")) then
cite = cite .. "|title="..title;
end;
if(not(publisher == nil or publisher == "")) then
cite = cite .. "|publisher="..publisher;
end;
--+2016-04-08T00:00:00Z
if(not(timestamp == nil or timestamp == "")) then
local year = string.sub(timestamp,2,5);