Pojdi na vsebino

Modul:WikidataGetCurrentId

Iz Wikipedije, proste enciklopedije
require "Modul:No globals"

local p = {}
 -- .. [[Kategorija:Objekta ni vpisanega v Wikipodatkih]]
 
local function loadCacheSafe( entityId )
	local status, result = pcall( function() return mw.loadData( 'Modul:WikidataCache/' .. entityId ) end );
	if ( status == true ) then
		return result;
	end
	return nil;
end

function p.getCurrentId()
    local entity = mw.wikibase.getEntityObject();
    if not entity then
    	return  '[[Kategorija:Objekta ni vpisanega v Wikipodatkih]]'; -- throwError( 'entity-not-found' )
    end
    -- local cached = loadCacheSafe( entity.id );
    -- if ( cached ) then
    -- 	return cached;
	-- end
    return entity.id;
end

return p