Modulo:Wikidata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m variabile globale a inizio modulo |
aggiunto parametro "cache" |
||
Riga 48:
}
-- Table per la funzione
local entitiesCache = {}
Riga 387:
-- Versione con cache di mw.wikibase.getEntity
local function
local ret
▲ if entityId then
if entityId then
ret = entitiesCache[entityId] if not ret then
ret = mw.wikibase.getEntity(entityId)
if ret then
entitiesCache[entityId] = ret
end
end
end
else
return mw.wikibase.getEntity(entityId)
end
return ret
Line 436 ⟶ 440:
-- get entity
entity =
if not entity then
return nil
Line 675 ⟶ 679:
-- Restituisce l'etichetta di un item o di una proprietà Wikidata.
function p._getLabel(args)
local entity =
return entity and entity:getLabel(args[2])
end
Line 700 ⟶ 704:
end
entity =
if not entity then
error(i18n.errors['entity-not-found'], 2)
|