Модул:scripts/templates
Зоҳир
Documentation for this module may be created at Модул:scripts/templates/doc
local export = {}
function export.exists(frame)
return require("Module:scripts").getByCode(
require("Module:parameters").process(frame.args, {
[1] = {required = true}
})[1]
) and "1" or ""
end
function export.getByCode(frame)
return require("Module:language-like").templateGetByCode(
require("Module:parameters").process(frame.args, {
[1] = {required = true, type = "script"},
[2] = {required = true},
[3] = {}
}),
function(itemname)
if itemname == "countCharacters" then
local text = args[3] or ""
return args[1]:countCharacters(text)
end
end
)
end
function export.getByCanonicalName(frame)
local sc = require("Module:scripts").getByCanonicalName(
require("Module:parameters").process(frame.args, {
[1] = {required = true}
})[1]
)
return sc and sc:getCode() or "None"
end
return export