Modul:Coordinates: Unterschied zwischen den Versionen
Tt (Diskussion | Beiträge) K 1 Version importiert |
Tt (Diskussion | Beiträge) K Guard mw.wikibase access so the module degrades gracefully without a Wikibase backend (fixes Lua error) |
||
| Zeile 771: | Zeile 771: | ||
local ID = args.wikidata | local ID = args.wikidata | ||
if ID == nil then | if ID == nil then | ||
entity = mw.wikibase.getEntity() | entity = (mw.wikibase and mw.wikibase.getEntity()) | ||
elseif type(ID) == 'string' and ID:match( '^[QqMm]%d+$' ) then | elseif type(ID) == 'string' and ID:match( '^[QqMm]%d+$' ) then | ||
entity = mw.wikibase.getEntity(ID) | entity = (mw.wikibase and mw.wikibase.getEntity(ID)) | ||
elseif type(ID) ~= 'string' and ID.id then | elseif type(ID) ~= 'string' and ID.id then | ||
entity = ID -- entities can be passed from outside | entity = ID -- entities can be passed from outside | ||