Fandom

BioShock Wiki

Module:FeaturedArticleBar

2,317pages on
this wiki
Add New Page
Talk0
--<pre>
local p = {}
 
function p.link( frame )
	local sTime = frame.args[1]
	local sLink = frame.args[2]
	local iMonthnr = os.date( "%m" )
	local iPrevMonth = iMonthnr - 1
	local iNextMonth = iMonthnr + 1
	local iWeeknr  = os.date( "%W" )
	local iPrevWeek = iWeeknr - 1
	local iNextWeek = iWeeknr + 1
	local iArticlenr
 
	if sLink == 'prev' then
		if sTime == 'week' then
			if iPrevWeek >= 52 then
				iArticlenr = 51
			elseif iPrevWeek <= 0 then
				iArticlenr = 52
			else
				iArticlenr = iPrevWeek
			end
		else
			if iPrevMonth <= 0 then
				iArticlenr = 12
			else
				iArticlenr = iPrevMonth
			end
		end
	else
		if sTime == 'week' then
			if iNextWeek >= 53 then
				iArticlenr = 1
			elseif iNextWeek == 1 then
			    iArticlenr = 2
			else
				iArticlenr = iNextWeek
			end
		else
			if iNextMonth >= 13 then
				iArticlenr = 1
			else
				iArticlenr = iNextMonth
			end
		end
	end
	return iArticlenr
end
 
return p
--</pre>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.