Module:Sandbox/1

From Wiktionary, the free dictionary
Jump to navigation Jump to search

local export = {}

function export.test1(frame)
	local templateobj = mw.title.new(frame:getParent():getTitle())
	--local template = frame:getTitle()
	--local templatename = template.text
	local templatename
	if templateobj.namespace == 10 then -- NS_TEMPLATE
		templatename = templateobj.text
	elseif templateobj.namespace == 0 then -- NS_MAIN
		templatename = 'main ns' .. ':' .. templateobj.text
	else
		templatename = 'other ns ' .. templateobj.prefixedText
	end
	return templatename
end

return export