View source for Module:Ancient Olympiads
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.
local data = mw.loadData( 'Module:Ancient Olympiads/data' )
local lang = mw.language.getContentLanguage()
local length = require( 'Module:Array length')
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
local dataLength = length(data)
-- Find the year in the data page and display the output.
for i = dataLength, 1, -1 do
local t = data[i]
if inputYear - 1 == t.year then
-- year of the Olympiad, test with = p._main( -495 )
-- The input year in the calendar is one after the expected (-775 for the year 776 BC). This is why all values need to be corrected by 1.
-- Year of Olympiad creates autolink to same page, therefore eliminated here
000
1:0
Template used on this page:
Return to Module:Ancient Olympiads.