Bu modul uchun Modul:Ancient Egypt kings/doc nomli hujjat sahifasini yaratishingiz mumkin

local data = mw.loadData( 'Module:Ancient Egypt kings/data' )
local lang = mw.language.getContentLanguage()

local p = {}

function p._main( inputYear )
	-- 
	inputYear = tonumber( inputYear )
	if not inputYear or inputYear > tonumber( lang:formatDate( 'Y' ) ) then
		return "''—''"
	end

	--  
	local dataLength = 0
	for i, t in ipairs( data ) do
		dataLength = i
	end

	--  
	for i = dataLength, 1, -1 do
		local t = data[i]
		if inputYear - 1 >= t.rulerstart and inputYear - 1 <= t.rulerend then
			--  
			return string.format(
				'[[%s]], %d',
				t.ruler, inputYear - t.rulerstart
			)
		end
	end
end

function p.main( frame )
	--  
	local args = require( 'Module:Arguments' ).getArgs( frame, {
		parentOnly = true
	} )
	return p._main( args[ 1 ] )
end

return p