Пређи на садржај

Модул:mul-domino def

Script error: The function "main" does not exist.

local m_str_utils = require("Модул:string utilities")

local cp = m_str_utils.codepoint
local ufind = m_str_utils.find
local ulen = m_str_utils.len
local usub = m_str_utils.sub

local m_unicode = require('Модул:Unicode data')

local export = {}

function export.definition(frame)

	local pageObject = mw.title.getCurrentTitle()
	local pageName = pageObject.text
	local codepoint = cp(pageName)
	local characterName = m_unicode.lookup_name(codepoint)

	local offset = ufind(characterName, "%-")

	local dominoes = {}

	if ulen(pageName) == 1 then
		dominoes[1] = usub (characterName, offset+2, offset+2)
		dominoes[2] = usub (characterName, offset+5, offset+5)
	else
		dominoes[1] = "a"
		dominoes[2] = "b"
	end

	local definition = "A [[domino]] [[tile]], the [[" .. dominoes[1] .. "]]-[[" .. dominoes[2] .. "]]."
	local category = "[[Категорија:mul:Домине]]"
	local result = definition .. category

	result = frame:expandTemplate { title = "n-g", args = { result } }
	return result

end

return export