🇮🇷 Iran Proxy | https://www.wikipedia.org/wiki/Module:Sandbox/trappist_the_monk/tab
Jump to content

Module:Sandbox/trappist the monk/tab

From Wikipedia, the free encyclopedia
require ('strict');

local tab_data_t = mw.ext.data.get ('Evolution of public funding of European political parties.tab').data;


--[[--------------------------< R O W _ G E T >----------------------------------------------------------------

fetch row data for <year>; returns funding allocated and received

]]

local function row_get (year)
	for _, row_t in ipairs (tab_data_t) do
		if year == row_t[1] then
			return row_t[2], row_t[3];
		end
	end
end


--[[--------------------------< M A X I M U M _ A L L O C A T E D _ G E T >------------------------------------

returns maximum allocated funding for <year>

]]

local function maximum_allocated_get (year)
	local allocated = row_get (year);
	if allocated then
		return allocated;
	else
		return 'error no allocated data for year: ' .. year;
	end
end


--[[--------------------------< A M O U N T _ R E C I E V E D _ G E T >----------------------------------------

returns amount of  funding received for <year>

]]

local function amount_received_get (year)
	local _, received = row_get (year);
	if received then
		return received;
	else
		return 'error no received data for year: ' .. year;
	end
end


--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]

return {
	maximum_allocated_get = maximum_allocated_get,
	amount_received_get = amount_received_get,
	}