View source for Module:Ancient Egypt kings
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
-- This module implements {{Ancient Egypt kings}}. It converts a year in the Gregorian
-- calendar to the equivalent year of the ancient Egyptian era organized by pharaohs and kings.
local data = mw.loadData( 'Module:Ancient Egypt kings/data' )
local lang = mw.language.getContentLanguage()
local p = {}
function p._main( inputYear )
-- Convert the input to an integer if possible. Return "N/A" if the input could
-- not be converted, or if the converted input is too big or too small.
inputYear = tonumber( inputYear )
if not inputYear or inputYear > tonumber( lang:formatDate( 'Y' ) ) then
return "''N/A''"
end
-- Find the length of the data.
-- We need the length of the data so that we can loop through it backwards.
-- Normally we can get the length of tables with the # operator, but this
-- doesn't work with mw.loadData, as mw.loadData uses a metatable, and the
-- # operator doesn't work for tables that use metatables.
000
1:0
Template used on this page:
Return to Module:Ancient Egypt kings.