Modul:Wikidata utilities: Unterschied zwischen den Versionen
KKeine Bearbeitungszusammenfassung |
(checkId entfernt) |
||
Zeile 1: | Zeile 1: | ||
local fw = {} | local fw = {} | ||
function fw.getEntity( id ) | function fw.getEntity( id ) | ||
local wrongQualifier = false | local wrongQualifier = false | ||
local entity = nil | local entity = nil | ||
if not id or id == '' then | |||
return '', entity, wrongQualifier | |||
end | |||
if mw.wikibase.isValidEntityId( id ) then | |||
-- expensive function call | -- expensive function call | ||
entity = mw.wikibase.getEntity( | entity = mw.wikibase.getEntity( id ) | ||
end | end | ||
return | if not entity then | ||
id = '' | |||
wrongQualifier = true | |||
end | |||
return id, entity, wrongQualifier | |||
end | end | ||