Модул:scripts/templates
Изглед
Script error: The function "main" does not exist.
local export = {}
function export.exists(frame)
return require("Модул:scripts").getByCode(
require("Модул:parameters").process(frame.args, {
[1] = {required = true}
})[1]
) and "1" or ""
end
function export.getByCode(frame)
return require("Модул:language-like").templateGetByCode(
require("Модул: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("Модул:scripts").getByCanonicalName(
require("Модул:parameters").process(frame.args, {
[1] = {required = true}
})[1]
)
return sc and sc:getCode() or "None"
end
function export.findBestScript(frame)
local args = require("Модул:parameters").process(frame.args, {
[1] = {required = true},
[2] = {required = true, type = "language"},
[3] = {}
})
if args[3] == "getCanonicalName" then
return args[2]:findBestScript(args[1]):getCanonicalName()
else
return args[2]:findBestScript(args[1]):getCode()
end
end
return export