Дополнительные действия
Для документации этого модуля может быть создана страница Модуль:ICCup entity count/doc
local Arguments = require('Module:Arguments')
local EntityCounter = {}
function EntityCounter.count(frame)
return EntityCounter._count(Arguments.getArgs(frame))
end
function EntityCounter._count(args)
local smwQuery = args.query
local conditions = args.conditions
local queryString = "[[" .. smwQuery .. "]]"
if conditions then
queryString = queryString .. conditions
end
local res = mw.smw.ask {
queryString,
"format=count"
}
if type(res) == 'table' and res[1] then
return res[1]
else
error("Ошибка при выполнении запроса: " .. tostring(res))
end
end
return EntityCounter