Modul:Flagg/Data/info

Fra MotorWiki
< Modul:Flagg
Revisjon per 22. jan. 2018 kl. 18:53 av Toro Andersen (diskusjon | bidrag) (Ny side: local p = {} local getArgs = require('Module:Arguments').getArgs function p.info(frame, args) local pagename = 'Modul:Flagg/Masterdata' local pg = mw.title.new( pagename) local te…)
(diff) ← Eldre revisjon | Nåværende revisjon (diff) | Nyere revisjon → (diff)
Hopp til navigering Hopp til søk

Dokumentasjon for denne modulen kan opprettes på Modul:Flagg/Data/info/dok

local p = {}
local getArgs = require('Module:Arguments').getArgs

function p.info(frame, args)
	local pagename = 'Modul:Flagg/Masterdata'
	local pg = mw.title.new( pagename)
    local text = pg:getContent()
    if not (text) then return "error: feilet i å laste mw.title.new(" .. pagename .. ")" end
   	local args = getArgs(frame)
	
	local Tables_A = ''
    local rows_A = ''
    local Areas_A = 0
	for area_A in mw.ustring.gmatch( text, '%[%"A%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_A = string.sub(area_A,3,-8)
    		
    		Areas_A = Areas_A+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_A
			local flagdata_A = require("Modul:Flagg/Masterdata").flagdata[area_A]
			local PageLink_A = flagdata_A.pagelink
			local Name_A = flagdata_A.name
			local DefFlag_A = flagdata_A.defflag
			if PageLink_A == nil then lenke_A = '[[' .. Name_A .. ']]' else lenke_A = '[[' .. PageLink_A .. '|' .. Name_A .. ']]' end
			Col0_A = '|' .. Areas_A .. '\n'
			Col1_A = '|' .. lenke_A .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_A .. '|dok]])</small>\n'
			Col2_A = '|<code>' .. area_A .. '</code>\n'
			Col3_A = '|align="center"|[[Fil:' .. DefFlag_A .. '|33x27px]]'
			ColHeader0_A = '#'
			ColHeader1_A = 'Land'
			ColHeader2_A = 'Argument 1'
			ColHeader3_A = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_A = ''
				local HistColHeaderx_A = ''
				local i_A = 1
 				repeat
					if flagdata_A['histyear'..i_A] then
						Histyearx_A = flagdata_A['histyear'..i_A]
						Histflagx_A = flagdata_A['histflag'..i_A]
						if i_A > 1 then
							Histyearfrom_A = flagdata_A['histyear'..i_A-1]+1 .. '–'
							Histyearto_A = Histyearx_A
						else
							Histyearfrom_A = "<="
							Histyearto_A = Histyearx_A
						end
						HistColHeaderx_A = HistColHeaderx_A .. '\n!' .. Histyearfrom_A .. Histyearx_A
					else
						break
					end
					Histyears_A = Histyears_A .. '\n|align="center"|[[Fil:' .. Histflagx_A .. '|33x27px]]'
					i_A=i_A+1
				until not flagdata_A['histyear' .. i_A]
				
			 	-- Henter ut olympiske flagg
				local OLyears_A = ''
				local OLColHeaderx_A = ''
				local j_A = 1
 				repeat
					if flagdata_A['OLyear'..j_A] then
						OLyearx_A = flagdata_A['OLyear'..j_A]
						OLflagx_A = flagdata_A['OLflag'..j_A]
						OLColHeaderx_A = OLColHeaderx_A .. '\n!' .. OLyearx_A
					else
						break
					end
					OLyears_A = OLyears_A .. '\n|align="center"|[[Fil:' .. OLflagx_A .. '|33x27px]]'
					j_A=j_A+1
				until not flagdata_A['OLyear' .. j_A]
				if flagdata_A['histyeara'] then
					histyeara_A = flagdata_A['histyeara']
					histflaga_A = flagdata_A['histflaga']
					ColHeadera_A = '\n!' .. histyeara_A
					yearsa_A = '\n|align="center"|[[Fil:' .. histflaga_A .. '|33x27px]]'
				else
					yearsa_A = ""
					ColHeadera_A = ""
				end
				if flagdata_A['histyearb'] then
					histyearb_A = flagdata_A['histyearb']
					histflagb_A = flagdata_A['histflagb']
					ColHeaderb_A = '\n!' .. histyearb_A
					yearsb_A = '\n|align="center"|[[Fil:' .. histflagb_A .. '|33x27px]]'
				else
					yearsb_A = ""
					ColHeaderb_A = ""
				end
				if flagdata_A['histyearc'] then
					histyearc_A = flagdata_A['histyearc']
					histflagc_A = flagdata_A['histflagc']
					ColHeaderc_A = '\n!' .. histyearc_A
					yearsc_A = '\n|align="center"|[[Fil:' .. histflagc_A .. '|33x27px]]'
				else
					yearsc_A = ""
					ColHeaderc_A = ""
				end
				if flagdata_A['naval'] then
					naval_A = flagdata_A['naval']
					ColHeaderNaval_A = '\n!naval'
					navalflag_A = '\n|align="center"|[[Fil:' .. naval_A .. '|33x27px]]'
				else
					navalflag_A = ""
					ColHeaderNaval_A = ""
				end
				if flagdata_A['airforce'] then
					airforce_A = flagdata_A['airforce']
					ColHeaderAirforce_A = '\n!airforce'
					airforceflag_A = '\n|align="center"|[[Fil:' .. airforce_A .. '|33x27px]]'
				else
					airforceflag_A = ""
					ColHeaderAirforce_A = ""
				end
				if flagdata_A['coastguard'] then
					coastguard_A = flagdata_A['coastguard']
					ColHeaderCoastguard_A = '\n!coastguard'
					coastguardflag_A = '\n|align="center"|[[Fil:' .. coastguard_A .. '|33x27px]]'
				else
					coastguardflag_A = ""
					ColHeaderCoastguard_A = ""
				end
				if flagdata_A['sultanatet'] then
					sultanatet_A = flagdata_A['sultanatet']
					ColHeaderSultanatet_A = '\n!sultanatet'
					sultanatetflag_A = '\n|align="center"|[[Fil:' .. sultanatet_A .. '|33x27px]]'
				else
					sultanatetflag_A = ""
					ColHeaderSultanatet_A = ""
				end
				if flagdata_A['coa'] then
					coa_A = flagdata_A['coa']
					ColHeaderCoa_A = '\n!våpen'
					coaflag_A = '\n|align="center"|[[Fil:' .. coa_A .. '|33x27px]]'
				else
					coaflag_A = ""
					ColHeaderCoa_A = ""
				end
				if flagdata_A['shield'] then
					shield_A = flagdata_A['shield']
					ColHeaderShield_A = '\n!skjold'
					shieldflag_A = '\n|align="center"|[[Fil:' .. shield_A .. '|33x27px]]'
				else
					shieldflag_A = ""
					ColHeaderShield_A = ""
				end
				if flagdata_A['seal'] then
					seal_A = flagdata_A['seal']
					ColHeaderSeal_A = '\n!segl'
					sealflag_A = '\n|align="center"|[[Fil:' .. seal_A .. '|33x27px]]'
				else
					sealflag_A = ""
					ColHeaderSeal_A = ""
				end
				if flagdata_A['football'] then
					football_A = flagdata_A['football']
					ColHeaderFootball_A = '\n!fotball'
					footballflag_A = '\n|align="center"|[[Fil:' .. football_A .. '|33x27px]]'
				else
					footballflag_A = ""
					ColHeaderFootball_A = ""
				end
				if flagdata_A['OLfootball'] then
					olfootball_A = flagdata_A['OLfootball']
					ColHeaderOLFootball_A = '\n!OL (fotball)'
					olfootballflag_A = '\n|align="center"|[[Fil:' .. olfootball_A .. '|33x27px]]'
				else
					olfootballflag_A = ""
					ColHeaderOLFootball_A = ""
				end
			ColEnd_A = '\n|-\n'
			ColYear_A = coaflag_A .. shieldflag_A .. sealflag_A .. Histyears_A .. OLyears_A .. yearsa_A .. yearsb_A .. yearsc_A .. navalflag_A .. airforceflag_A .. coastguardflag_A
						.. sultanatetflag_A .. coaflag_A .. footballflag_A .. olfootballflag_A
			ColHeaderx_A = ColHeaderCoa_A .. ColHeaderShield_A .. ColHeaderSeal_A .. HistColHeaderx_A .. ColHeadera_A .. ColHeaderb_A .. ColHeaderc_A .. OLColHeaderx_A .. ColHeaderNaval_A ..
						ColHeaderAirforce_A .. ColHeaderCoastguard_A .. ColHeaderSultanatet_A .. ColHeaderCoa_A ..
						ColHeaderFootball_A .. ColHeaderOLFootball_A
			TableHeader_A = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_A .. '\n!' .. ColHeader1_A .. '\n!' .. ColHeader2_A .. '\n!' .. ColHeader3_A .. ColHeaderx_A .. '\n' ..
[=[|-
]=]
			TableBottom_A = '|}\n'
			row_A = Col0_A .. Col1_A .. Col2_A .. Col3_A .. ColYear_A .. ColEnd_A
			rows_A = rows_A .. row_A
			Table_A = TableHeader_A .. row_A .. TableBottom_A
			Tables_A = Tables_A .. Table_A
	end
	
	local Tables_B = ''
    local rows_B = ''
    local Areas_B = 0
	for area_B in mw.ustring.gmatch( text, '%[%"B%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_B = string.sub(area_B,3,-8)
    		
    		Areas_B = Areas_B+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_B
			local flagdata_B = require("Modul:Flagg/Masterdata").flagdata[area_B]
			local PageLink_B = flagdata_B.pagelink
			local Name_B = flagdata_B.name
			local DefFlag_B = flagdata_B.defflag
			if PageLink_B == nil then lenke_B = '[[' .. Name_B .. ']]' else lenke_B = '[[' .. PageLink_B .. '|' .. Name_B .. ']]' end
			Col0_B = '|' .. Areas_B .. '\n'
			Col1_B = '|' .. lenke_B .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_B .. '|dok]])</small>\n'
			Col2_B = '|<code>' .. area_B .. '</code>\n'
			Col3_B = '|align="center"|[[Fil:' .. DefFlag_B .. '|33x27px]]'
			ColHeader0_B = '#'
			ColHeader1_B = 'Land'
			ColHeader2_B = 'Argument 1'
			ColHeader3_B = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_B = ''
				local HistColHeaderx_B = ''
				local i_B = 1
 				repeat
					if flagdata_B['histyear'..i_B] then
						Histyearx_B = flagdata_B['histyear'..i_B]
						Histflagx_B = flagdata_B['histflag'..i_B]
						if i_B > 1 then
							Histyearfrom_B = flagdata_B['histyear'..i_B-1]+1 .. '–'
							Histyearto_B = Histyearx_B
						else
							Histyearfrom_B = "<="
							Histyearto_B = Histyearx_B
						end
						HistColHeaderx_B = HistColHeaderx_B .. '\n!' .. Histyearfrom_B .. Histyearx_B
					else
						break
					end
					Histyears_B = Histyears_B .. '\n|align="center"|[[Fil:' .. Histflagx_B .. '|33x27px]]'
					i_B=i_B+1
				until not flagdata_B['histyear' .. i_B]
				
			 	-- Henter ut olympiske flagg
				local OLyears_B = ''
				local OLColHeaderx_B = ''
				local j_B = 1
 				repeat
					if flagdata_B['OLyear'..j_B] then
						OLyearx_B = flagdata_B['OLyear'..j_B]
						OLflagx_B = flagdata_B['OLflag'..j_B]
						OLColHeaderx_B = OLColHeaderx_B .. '\n!' .. OLyearx_B
					else
						break
					end
					OLyears_B = OLyears_B .. '\n|align="center"|[[Fil:' .. OLflagx_B .. '|33x27px]]'
					j_B=j_B+1
				until not flagdata_B['OLyear' .. j_B]
				if flagdata_B['histyeara'] then
					histyeara_B = flagdata_B['histyeara']
					histflaga_B = flagdata_B['histflaga']
					ColHeadera_B = '\n!' .. histyeara_B
					yearsa_B = '\n|align="center"|[[Fil:' .. histflaga_B .. '|33x27px]]'
				else
					yearsa_B = ""
					ColHeadera_B = ""
				end
				if flagdata_B['histyearb'] then
					histyearb_B = flagdata_B['histyearb']
					histflagb_B = flagdata_B['histflagb']
					ColHeaderb_B = '\n!' .. histyearb_B
					yearsb_B = '\n|align="center"|[[Fil:' .. histflagb_B .. '|33x27px]]'
				else
					yearsb_B = ""
					ColHeaderb_B = ""
				end
				if flagdata_B['histyearc'] then
					histyearc_B = flagdata_B['histyearc']
					histflagc_B = flagdata_B['histflagc']
					ColHeaderc_B = '\n!' .. histyearc_B
					yearsc_B = '\n|align="center"|[[Fil:' .. histflagc_B .. '|33x27px]]'
				else
					yearsc_B = ""
					ColHeaderc_B = ""
				end
				if flagdata_B['naval'] then
					naval_B = flagdata_B['naval']
					ColHeaderNaval_B = '\n!naval'
					navalflag_B = '\n|align="center"|[[Fil:' .. naval_B .. '|33x27px]]'
				else
					navalflag_B = ""
					ColHeaderNaval_B = ""
				end
				if flagdata_B['airforce'] then
					airforce_B = flagdata_B['airforce']
					ColHeaderAirforce_B = '\n!airforce'
					airforceflag_B = '\n|align="center"|[[Fil:' .. airforce_B .. '|33x27px]]'
				else
					airforceflag_B = ""
					ColHeaderAirforce_B = ""
				end
				if flagdata_B['coastguard'] then
					coastguard_B = flagdata_B['coastguard']
					ColHeaderCoastguard_B = '\n!coastguard'
					coastguardflag_B = '\n|align="center"|[[Fil:' .. coastguard_B .. '|33x27px]]'
				else
					coastguardflag_B = ""
					ColHeaderCoastguard_B = ""
				end
				if flagdata_B['sultanatet'] then
					sultanatet_B = flagdata_B['sultanatet']
					ColHeaderSultanatet_B = '\n!sultanatet'
					sultanatetflag_B = '\n|align="center"|[[Fil:' .. sultanatet_B .. '|33x27px]]'
				else
					sultanatetflag_B = ""
					ColHeaderSultanatet_B = ""
				end
				if flagdata_B['coa'] then
					coa_B = flagdata_B['coa']
					ColHeaderCoa_B = '\n!våpen'
					coaflag_B = '\n|align="center"|[[Fil:' .. coa_B .. '|33x27px]]'
				else
					coaflag_B = ""
					ColHeaderCoa_B = ""
				end
				if flagdata_B['shield'] then
					shield_B = flagdata_B['shield']
					ColHeaderShield_B = '\n!skjold'
					shieldflag_B = '\n|align="center"|[[Fil:' .. shield_B .. '|33x27px]]'
				else
					shieldflag_B = ""
					ColHeaderShield_B = ""
				end
				if flagdata_B['seal'] then
					seal_B = flagdata_B['seal']
					ColHeaderSeal_B = '\n!segl'
					sealflag_B = '\n|align="center"|[[Fil:' .. seal_B .. '|33x27px]]'
				else
					sealflag_B = ""
					ColHeaderSeal_B = ""
				end
				if flagdata_B['football'] then
					football_B = flagdata_B['football']
					ColHeaderFootball_B = '\n!fotball'
					footballflag_B = '\n|align="center"|[[Fil:' .. football_B .. '|33x27px]]'
				else
					footballflag_B = ""
					ColHeaderFootball_B = ""
				end
				if flagdata_B['OLfootball'] then
					olfootball_B = flagdata_B['OLfootball']
					ColHeaderOLFootball_B = '\n!OL (fotball)'
					olfootballflag_B = '\n|align="center"|[[Fil:' .. olfootball_B .. '|33x27px]]'
				else
					olfootballflag_B = ""
					ColHeaderOLFootball_B = ""
				end
			ColEnd_B = '\n|-\n'
			ColYear_B = coaflag_B .. shieldflag_B .. sealflag_B .. Histyears_B .. OLyears_B .. yearsa_B .. yearsb_B .. yearsc_B .. navalflag_B .. airforceflag_B .. coastguardflag_B
						.. sultanatetflag_B .. coaflag_B .. footballflag_B .. olfootballflag_B
			ColHeaderx_B = ColHeaderCoa_B .. ColHeaderShield_B .. ColHeaderSeal_B .. HistColHeaderx_B .. ColHeadera_B .. ColHeaderb_B .. ColHeaderc_B .. OLColHeaderx_B .. ColHeaderNaval_B ..
						ColHeaderAirforce_B .. ColHeaderCoastguard_B .. ColHeaderSultanatet_B .. ColHeaderCoa_B ..
						ColHeaderFootball_B .. ColHeaderOLFootball_B
			TableHeader_B = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_B .. '\n!' .. ColHeader1_B .. '\n!' .. ColHeader2_B .. '\n!' .. ColHeader3_B .. ColHeaderx_B .. '\n' ..
[=[|-
]=]
			TableBottom_B = '|}\n'
			row_B = Col0_B .. Col1_B .. Col2_B .. Col3_B .. ColYear_B .. ColEnd_B
			rows_B = rows_B .. row_B
			Table_B = TableHeader_B .. row_B .. TableBottom_B
			Tables_B = Tables_B .. Table_B
	end
	
	local Tables_C = ''
    local rows_C = ''
    local Areas_C = 0
	for area_C in mw.ustring.gmatch( text, '%[%"C%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_C = string.sub(area_C,3,-8)
    		
    		Areas_C = Areas_C+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_C
			local flagdata_C = require("Modul:Flagg/Masterdata").flagdata[area_C]
			local PageLink_C = flagdata_C.pagelink
			local Name_C = flagdata_C.name
			local DefFlag_C = flagdata_C.defflag
			if PageLink_C == nil then lenke_C = '[[' .. Name_C .. ']]' else lenke_C = '[[' .. PageLink_C .. '|' .. Name_C .. ']]' end
			Col0_C = '|' .. Areas_C .. '\n'
			Col1_C = '|' .. lenke_C .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_C .. '|dok]])</small>\n'
			Col2_C = '|<code>' .. area_C .. '</code>\n'
			Col3_C = '|align="center"|[[Fil:' .. DefFlag_C .. '|33x27px]]'
			ColHeader0_C = '#'
			ColHeader1_C = 'Land'
			ColHeader2_C = 'Argument 1'
			ColHeader3_C = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_C = ''
				local HistColHeaderx_C = ''
				local i_C = 1
 				repeat
					if flagdata_C['histyear'..i_C] then
						Histyearx_C = flagdata_C['histyear'..i_C]
						Histflagx_C = flagdata_C['histflag'..i_C]
						if i_C > 1 then
							Histyearfrom_C = flagdata_C['histyear'..i_C-1]+1 .. '–'
							Histyearto_C = Histyearx_C
						else
							Histyearfrom_C = "<="
							Histyearto_C = Histyearx_C
						end
						HistColHeaderx_C = HistColHeaderx_C .. '\n!' .. Histyearfrom_C .. Histyearx_C
					else
						break
					end
					Histyears_C = Histyears_C .. '\n|align="center"|[[Fil:' .. Histflagx_C .. '|33x27px]]'
					i_C=i_C+1
				until not flagdata_C['histyear' .. i_C]
				
			 	-- Henter ut olympiske flagg
				local OLyears_C = ''
				local OLColHeaderx_C = ''
				local j_C = 1
 				repeat
					if flagdata_C['OLyear'..j_C] then
						OLyearx_C = flagdata_C['OLyear'..j_C]
						OLflagx_C = flagdata_C['OLflag'..j_C]
						OLColHeaderx_C = OLColHeaderx_C .. '\n!' .. OLyearx_C
					else
						break
					end
					OLyears_C = OLyears_C .. '\n|align="center"|[[Fil:' .. OLflagx_C .. '|33x27px]]'
					j_C=j_C+1
				until not flagdata_C['OLyear' .. j_C]
				if flagdata_C['histyeara'] then
					histyeara_C = flagdata_C['histyeara']
					histflaga_C = flagdata_C['histflaga']
					ColHeadera_C = '\n!' .. histyeara_C
					yearsa_C = '\n|align="center"|[[Fil:' .. histflaga_C .. '|33x27px]]'
				else
					yearsa_C = ""
					ColHeadera_C = ""
				end
				if flagdata_C['histyearb'] then
					histyearb_C = flagdata_C['histyearb']
					histflagb_C = flagdata_C['histflagb']
					ColHeaderb_C = '\n!' .. histyearb_C
					yearsb_C = '\n|align="center"|[[Fil:' .. histflagb_C .. '|33x27px]]'
				else
					yearsb_C = ""
					ColHeaderb_C = ""
				end
				if flagdata_C['histyearc'] then
					histyearc_C = flagdata_C['histyearc']
					histflagc_C = flagdata_C['histflagc']
					ColHeaderc_C = '\n!' .. histyearc_C
					yearsc_C = '\n|align="center"|[[Fil:' .. histflagc_C .. '|33x27px]]'
				else
					yearsc_C = ""
					ColHeaderc_C = ""
				end
				if flagdata_C['naval'] then
					naval_C = flagdata_C['naval']
					ColHeaderNaval_C = '\n!naval'
					navalflag_C = '\n|align="center"|[[Fil:' .. naval_C .. '|33x27px]]'
				else
					navalflag_C = ""
					ColHeaderNaval_C = ""
				end
				if flagdata_C['airforce'] then
					airforce_C = flagdata_C['airforce']
					ColHeaderAirforce_C = '\n!airforce'
					airforceflag_C = '\n|align="center"|[[Fil:' .. airforce_C .. '|33x27px]]'
				else
					airforceflag_C = ""
					ColHeaderAirforce_C = ""
				end
				if flagdata_C['coastguard'] then
					coastguard_C = flagdata_C['coastguard']
					ColHeaderCoastguard_C = '\n!coastguard'
					coastguardflag_C = '\n|align="center"|[[Fil:' .. coastguard_C .. '|33x27px]]'
				else
					coastguardflag_C = ""
					ColHeaderCoastguard_C = ""
				end
				if flagdata_C['sultanatet'] then
					sultanatet_C = flagdata_C['sultanatet']
					ColHeaderSultanatet_C = '\n!sultanatet'
					sultanatetflag_C = '\n|align="center"|[[Fil:' .. sultanatet_C .. '|33x27px]]'
				else
					sultanatetflag_C = ""
					ColHeaderSultanatet_C = ""
				end
				if flagdata_C['coa'] then
					coa_C = flagdata_C['coa']
					ColHeaderCoa_C = '\n!våpen'
					coaflag_C = '\n|align="center"|[[Fil:' .. coa_C .. '|33x27px]]'
				else
					coaflag_C = ""
					ColHeaderCoa_C = ""
				end
				if flagdata_C['shield'] then
					shield_C = flagdata_C['shield']
					ColHeaderShield_C = '\n!skjold'
					shieldflag_C = '\n|align="center"|[[Fil:' .. shield_C .. '|33x27px]]'
				else
					shieldflag_C = ""
					ColHeaderShield_C = ""
				end
				if flagdata_C['seal'] then
					seal_C = flagdata_C['seal']
					ColHeaderSeal_C = '\n!segl'
					sealflag_C = '\n|align="center"|[[Fil:' .. seal_C .. '|33x27px]]'
				else
					sealflag_C = ""
					ColHeaderSeal_C = ""
				end
				if flagdata_C['football'] then
					football_C = flagdata_C['football']
					ColHeaderFootball_C = '\n!fotball'
					footballflag_C = '\n|align="center"|[[Fil:' .. football_C .. '|33x27px]]'
				else
					footballflag_C = ""
					ColHeaderFootball_C = ""
				end
				if flagdata_C['OLfootball'] then
					olfootball_C = flagdata_C['OLfootball']
					ColHeaderOLFootball_C = '\n!OL (fotball)'
					olfootballflag_C = '\n|align="center"|[[Fil:' .. olfootball_C .. '|33x27px]]'
				else
					olfootballflag_C = ""
					ColHeaderOLFootball_C = ""
				end
			ColEnd_C = '\n|-\n'
			ColYear_C = coaflag_C .. shieldflag_C .. sealflag_C .. Histyears_C .. OLyears_C .. yearsa_C .. yearsb_C .. yearsc_C .. navalflag_C .. airforceflag_C .. coastguardflag_C
						.. sultanatetflag_C .. coaflag_C .. footballflag_C .. olfootballflag_C
			ColHeaderx_C = ColHeaderCoa_C .. ColHeaderShield_C .. ColHeaderSeal_C .. HistColHeaderx_C .. ColHeadera_C .. ColHeaderb_C .. ColHeaderc_C .. OLColHeaderx_C .. ColHeaderNaval_C ..
						ColHeaderAirforce_C .. ColHeaderCoastguard_C .. ColHeaderSultanatet_C .. ColHeaderCoa_C ..
						ColHeaderFootball_C .. ColHeaderOLFootball_C
			TableHeader_C = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_C .. '\n!' .. ColHeader1_C .. '\n!' .. ColHeader2_C .. '\n!' .. ColHeader3_C .. ColHeaderx_C .. '\n' ..
[=[|-
]=]
			TableBottom_C = '|}\n'
			row_C = Col0_C .. Col1_C .. Col2_C .. Col3_C .. ColYear_C .. ColEnd_C
			rows_C = rows_C .. row_C
			Table_C = TableHeader_C .. row_C .. TableBottom_C
			Tables_C = Tables_C .. Table_C
	end
	
	local Tables_D = ''
    local rows_D = ''
    local Areas_D = 0
	for area_D in mw.ustring.gmatch( text, '%[%"D%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_D = string.sub(area_D,3,-8)
    		
    		Areas_D = Areas_D+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_D
			local flagdata_D = require("Modul:Flagg/Masterdata").flagdata[area_D]
			local PageLink_D = flagdata_D.pagelink
			local Name_D = flagdata_D.name
			local DefFlag_D = flagdata_D.defflag
			if PageLink_D == nil then lenke_D = '[[' .. Name_D .. ']]' else lenke_D = '[[' .. PageLink_D .. '|' .. Name_D .. ']]' end
			Col0_D = '|' .. Areas_D .. '\n'
			Col1_D = '|' .. lenke_D .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_D .. '|dok]])</small>\n'
			Col2_D = '|<code>' .. area_D .. '</code>\n'
			Col3_D = '|align="center"|[[Fil:' .. DefFlag_D .. '|33x27px]]'
			ColHeader0_D = '#'
			ColHeader1_D = 'Land'
			ColHeader2_D = 'Argument 1'
			ColHeader3_D = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_D = ''
				local HistColHeaderx_D = ''
				local i_D = 1
 				repeat
					if flagdata_D['histyear'..i_D] then
						Histyearx_D = flagdata_D['histyear'..i_D]
						Histflagx_D = flagdata_D['histflag'..i_D]
						if i_D > 1 then
							Histyearfrom_D = flagdata_D['histyear'..i_D-1]+1 .. '–'
							Histyearto_D = Histyearx_D
						else
							Histyearfrom_D = "<="
							Histyearto_D = Histyearx_D
						end
						HistColHeaderx_D = HistColHeaderx_D .. '\n!' .. Histyearfrom_D .. Histyearx_D
					else
						break
					end
					Histyears_D = Histyears_D .. '\n|align="center"|[[Fil:' .. Histflagx_D .. '|33x27px]]'
					i_D=i_D+1
				until not flagdata_D['histyear' .. i_D]
				
			 	-- Henter ut olympiske flagg
				local OLyears_D = ''
				local OLColHeaderx_D = ''
				local j_D = 1
 				repeat
					if flagdata_D['OLyear'..j_D] then
						OLyearx_D = flagdata_D['OLyear'..j_D]
						OLflagx_D = flagdata_D['OLflag'..j_D]
						OLColHeaderx_D = OLColHeaderx_D .. '\n!' .. OLyearx_D
					else
						break
					end
					OLyears_D = OLyears_D .. '\n|align="center"|[[Fil:' .. OLflagx_D .. '|33x27px]]'
					j_D=j_D+1
				until not flagdata_D['OLyear' .. j_D]
				if flagdata_D['histyeara'] then
					histyeara_D = flagdata_D['histyeara']
					histflaga_D = flagdata_D['histflaga']
					ColHeadera_D = '\n!' .. histyeara_D
					yearsa_D = '\n|align="center"|[[Fil:' .. histflaga_D .. '|33x27px]]'
				else
					yearsa_D = ""
					ColHeadera_D = ""
				end
				if flagdata_D['histyearb'] then
					histyearb_D = flagdata_D['histyearb']
					histflagb_D = flagdata_D['histflagb']
					ColHeaderb_D = '\n!' .. histyearb_D
					yearsb_D = '\n|align="center"|[[Fil:' .. histflagb_D .. '|33x27px]]'
				else
					yearsb_D = ""
					ColHeaderb_D = ""
				end
				if flagdata_D['histyearc'] then
					histyearc_D = flagdata_D['histyearc']
					histflagc_D = flagdata_D['histflagc']
					ColHeaderc_D = '\n!' .. histyearc_D
					yearsc_D = '\n|align="center"|[[Fil:' .. histflagc_D .. '|33x27px]]'
				else
					yearsc_D = ""
					ColHeaderc_D = ""
				end
				if flagdata_D['naval'] then
					naval_D = flagdata_D['naval']
					ColHeaderNaval_D = '\n!naval'
					navalflag_D = '\n|align="center"|[[Fil:' .. naval_D .. '|33x27px]]'
				else
					navalflag_D = ""
					ColHeaderNaval_D = ""
				end
				if flagdata_D['airforce'] then
					airforce_D = flagdata_D['airforce']
					ColHeaderAirforce_D = '\n!airforce'
					airforceflag_D = '\n|align="center"|[[Fil:' .. airforce_D .. '|33x27px]]'
				else
					airforceflag_D = ""
					ColHeaderAirforce_D = ""
				end
				if flagdata_D['coastguard'] then
					coastguard_D = flagdata_D['coastguard']
					ColHeaderCoastguard_D = '\n!coastguard'
					coastguardflag_D = '\n|align="center"|[[Fil:' .. coastguard_D .. '|33x27px]]'
				else
					coastguardflag_D = ""
					ColHeaderCoastguard_D = ""
				end
				if flagdata_D['sultanatet'] then
					sultanatet_D = flagdata_D['sultanatet']
					ColHeaderSultanatet_D = '\n!sultanatet'
					sultanatetflag_D = '\n|align="center"|[[Fil:' .. sultanatet_D .. '|33x27px]]'
				else
					sultanatetflag_D = ""
					ColHeaderSultanatet_D = ""
				end
				if flagdata_D['coa'] then
					coa_D = flagdata_D['coa']
					ColHeaderCoa_D = '\n!våpen'
					coaflag_D = '\n|align="center"|[[Fil:' .. coa_D .. '|33x27px]]'
				else
					coaflag_D = ""
					ColHeaderCoa_D = ""
				end
				if flagdata_D['shield'] then
					shield_D = flagdata_D['shield']
					ColHeaderShield_D = '\n!skjold'
					shieldflag_D = '\n|align="center"|[[Fil:' .. shield_D .. '|33x27px]]'
				else
					shieldflag_D = ""
					ColHeaderShield_D = ""
				end
				if flagdata_D['seal'] then
					seal_D = flagdata_D['seal']
					ColHeaderSeal_D = '\n!segl'
					sealflag_D = '\n|align="center"|[[Fil:' .. seal_D .. '|33x27px]]'
				else
					sealflag_D = ""
					ColHeaderSeal_D = ""
				end
				if flagdata_D['football'] then
					football_D = flagdata_D['football']
					ColHeaderFootball_D = '\n!fotball'
					footballflag_D = '\n|align="center"|[[Fil:' .. football_D .. '|33x27px]]'
				else
					footballflag_D = ""
					ColHeaderFootball_D = ""
				end
				if flagdata_D['OLfootball'] then
					olfootball_D = flagdata_D['OLfootball']
					ColHeaderOLFootball_D = '\n!OL (fotball)'
					olfootballflag_D = '\n|align="center"|[[Fil:' .. olfootball_D .. '|33x27px]]'
				else
					olfootballflag_D = ""
					ColHeaderOLFootball_D = ""
				end
			ColEnd_D = '\n|-\n'
			ColYear_D = coaflag_D .. shieldflag_D .. sealflag_D .. Histyears_D .. OLyears_D .. yearsa_D .. yearsb_D .. yearsc_D .. navalflag_D .. airforceflag_D .. coastguardflag_D
						.. sultanatetflag_D .. coaflag_D .. footballflag_D .. olfootballflag_D
			ColHeaderx_D = ColHeaderCoa_D .. ColHeaderShield_D .. ColHeaderSeal_D .. HistColHeaderx_D .. ColHeadera_D .. ColHeaderb_D .. ColHeaderc_D .. OLColHeaderx_D .. ColHeaderNaval_D ..
						ColHeaderAirforce_D .. ColHeaderCoastguard_D .. ColHeaderSultanatet_D .. ColHeaderCoa_D ..
						ColHeaderFootball_D .. ColHeaderOLFootball_D
			TableHeader_D = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_D .. '\n!' .. ColHeader1_D .. '\n!' .. ColHeader2_D .. '\n!' .. ColHeader3_D .. ColHeaderx_D .. '\n' ..
[=[|-
]=]
			TableBottom_D = '|}\n'
			row_D = Col0_D .. Col1_D .. Col2_D .. Col3_D .. ColYear_D .. ColEnd_D
			rows_D = rows_D .. row_D
			Table_D = TableHeader_D .. row_D .. TableBottom_D
			Tables_D = Tables_D .. Table_D
	end
	
	local Tables_E = ''
    local rows_E = ''
    local Areas_E = 0
	for area_E in mw.ustring.gmatch( text, '%[%"E%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_E = string.sub(area_E,3,-8)
    		
    		Areas_E = Areas_E+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_E
			local flagdata_E = require("Modul:Flagg/Masterdata").flagdata[area_E]
			local PageLink_E = flagdata_E.pagelink
			local Name_E = flagdata_E.name
			local DefFlag_E = flagdata_E.defflag
			if PageLink_E == nil then lenke_E = '[[' .. Name_E .. ']]' else lenke_E = '[[' .. PageLink_E .. '|' .. Name_E .. ']]' end
			Col0_E = '|' .. Areas_E .. '\n'
			Col1_E = '|' .. lenke_E .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_E .. '|dok]])</small>\n'
			Col2_E = '|<code>' .. area_E .. '</code>\n'
			Col3_E = '|align="center"|[[Fil:' .. DefFlag_E .. '|33x27px]]'
			ColHeader0_E = '#'
			ColHeader1_E = 'Land'
			ColHeader2_E = 'Argument 1'
			ColHeader3_E = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_E = ''
				local HistColHeaderx_E = ''
				local i_E = 1
 				repeat
					if flagdata_E['histyear'..i_E] then
						Histyearx_E = flagdata_E['histyear'..i_E]
						Histflagx_E = flagdata_E['histflag'..i_E]
						if i_E > 1 then
							Histyearfrom_E = flagdata_E['histyear'..i_E-1]+1 .. '–'
							Histyearto_E = Histyearx_E
						else
							Histyearfrom_E = "<="
							Histyearto_E = Histyearx_E
						end
						HistColHeaderx_E = HistColHeaderx_E .. '\n!' .. Histyearfrom_E .. Histyearx_E
					else
						break
					end
					Histyears_E = Histyears_E .. '\n|align="center"|[[Fil:' .. Histflagx_E .. '|33x27px]]'
					i_E=i_E+1
				until not flagdata_E['histyear' .. i_E]
				
			 	-- Henter ut olympiske flagg
				local OLyears_E = ''
				local OLColHeaderx_E = ''
				local j_E = 1
 				repeat
					if flagdata_E['OLyear'..j_E] then
						OLyearx_E = flagdata_E['OLyear'..j_E]
						OLflagx_E = flagdata_E['OLflag'..j_E]
						OLColHeaderx_E = OLColHeaderx_E .. '\n!' .. OLyearx_E
					else
						break
					end
					OLyears_E = OLyears_E .. '\n|align="center"|[[Fil:' .. OLflagx_E .. '|33x27px]]'
					j_E=j_E+1
				until not flagdata_E['OLyear' .. j_E]
				if flagdata_E['histyeara'] then
					histyeara_E = flagdata_E['histyeara']
					histflaga_E = flagdata_E['histflaga']
					ColHeadera_E = '\n!' .. histyeara_E
					yearsa_E = '\n|align="center"|[[Fil:' .. histflaga_E .. '|33x27px]]'
				else
					yearsa_E = ""
					ColHeadera_E = ""
				end
				if flagdata_E['histyearb'] then
					histyearb_E = flagdata_E['histyearb']
					histflagb_E = flagdata_E['histflagb']
					ColHeaderb_E = '\n!' .. histyearb_E
					yearsb_E = '\n|align="center"|[[Fil:' .. histflagb_E .. '|33x27px]]'
				else
					yearsb_E = ""
					ColHeaderb_E = ""
				end
				if flagdata_E['histyearc'] then
					histyearc_E = flagdata_E['histyearc']
					histflagc_E = flagdata_E['histflagc']
					ColHeaderc_E = '\n!' .. histyearc_E
					yearsc_E = '\n|align="center"|[[Fil:' .. histflagc_E .. '|33x27px]]'
				else
					yearsc_E = ""
					ColHeaderc_E = ""
				end
				if flagdata_E['naval'] then
					naval_E = flagdata_E['naval']
					ColHeaderNaval_E = '\n!naval'
					navalflag_E = '\n|align="center"|[[Fil:' .. naval_E .. '|33x27px]]'
				else
					navalflag_E = ""
					ColHeaderNaval_E = ""
				end
				if flagdata_E['airforce'] then
					airforce_E = flagdata_E['airforce']
					ColHeaderAirforce_E = '\n!airforce'
					airforceflag_E = '\n|align="center"|[[Fil:' .. airforce_E .. '|33x27px]]'
				else
					airforceflag_E = ""
					ColHeaderAirforce_E = ""
				end
				if flagdata_E['coastguard'] then
					coastguard_E = flagdata_E['coastguard']
					ColHeaderCoastguard_E = '\n!coastguard'
					coastguardflag_E = '\n|align="center"|[[Fil:' .. coastguard_E .. '|33x27px]]'
				else
					coastguardflag_E = ""
					ColHeaderCoastguard_E = ""
				end
				if flagdata_E['sultanatet'] then
					sultanatet_E = flagdata_E['sultanatet']
					ColHeaderSultanatet_E = '\n!sultanatet'
					sultanatetflag_E = '\n|align="center"|[[Fil:' .. sultanatet_E .. '|33x27px]]'
				else
					sultanatetflag_E = ""
					ColHeaderSultanatet_E = ""
				end
				if flagdata_E['coa'] then
					coa_E = flagdata_E['coa']
					ColHeaderCoa_E = '\n!våpen'
					coaflag_E = '\n|align="center"|[[Fil:' .. coa_E .. '|33x27px]]'
				else
					coaflag_E = ""
					ColHeaderCoa_E = ""
				end
				if flagdata_E['shield'] then
					shield_E = flagdata_E['shield']
					ColHeaderShield_E = '\n!skjold'
					shieldflag_E = '\n|align="center"|[[Fil:' .. shield_E .. '|33x27px]]'
				else
					shieldflag_E = ""
					ColHeaderShield_E = ""
				end
				if flagdata_E['seal'] then
					seal_E = flagdata_E['seal']
					ColHeaderSeal_E = '\n!segl'
					sealflag_E = '\n|align="center"|[[Fil:' .. seal_E .. '|33x27px]]'
				else
					sealflag_E = ""
					ColHeaderSeal_E = ""
				end
				if flagdata_E['football'] then
					football_E = flagdata_E['football']
					ColHeaderFootball_E = '\n!fotball'
					footballflag_E = '\n|align="center"|[[Fil:' .. football_E .. '|33x27px]]'
				else
					footballflag_E = ""
					ColHeaderFootball_E = ""
				end
				if flagdata_E['OLfootball'] then
					olfootball_E = flagdata_E['OLfootball']
					ColHeaderOLFootball_E = '\n!OL (fotball)'
					olfootballflag_E = '\n|align="center"|[[Fil:' .. olfootball_E .. '|33x27px]]'
				else
					olfootballflag_E = ""
					ColHeaderOLFootball_E = ""
				end
			ColEnd_E = '\n|-\n'
			ColYear_E = coaflag_E .. shieldflag_E .. sealflag_E .. Histyears_E .. OLyears_E .. yearsa_E .. yearsb_E .. yearsc_E .. navalflag_E .. airforceflag_E .. coastguardflag_E
						.. sultanatetflag_E .. coaflag_E .. footballflag_E .. olfootballflag_E
			ColHeaderx_E = ColHeaderCoa_E .. ColHeaderShield_E .. ColHeaderSeal_E .. HistColHeaderx_E .. ColHeadera_E .. ColHeaderb_E .. ColHeaderc_E .. OLColHeaderx_E .. ColHeaderNaval_E ..
						ColHeaderAirforce_E .. ColHeaderCoastguard_E .. ColHeaderSultanatet_E .. ColHeaderCoa_E ..
						ColHeaderFootball_E .. ColHeaderOLFootball_E
			TableHeader_E = '\n' .. 
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_E .. '\n!' .. ColHeader1_E .. '\n!' .. ColHeader2_E .. '\n!' .. ColHeader3_E .. ColHeaderx_E .. '\n' ..
[=[|-
]=]
			TableBottom_E = '|}\n'
			row_E = Col0_E .. Col1_E .. Col2_E .. Col3_E .. ColYear_E .. ColEnd_E
			rows_E = rows_E .. row_E
			Table_E = TableHeader_E .. row_E .. TableBottom_E
			Tables_E = Tables_E .. Table_E
	end
	
	local Tables_F = ''
    local rows_F = ''
    local Areas_F = 0
	for area_F in mw.ustring.gmatch( text, '%[%"F%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_F = string.sub(area_F,3,-8)
    		
    		Areas_F = Areas_F+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_F
			local flagdata_F = require("Modul:Flagg/Masterdata").flagdata[area_F]
			local PageLink_F = flagdata_F.pagelink
			local Name_F = flagdata_F.name
			local DefFlag_F = flagdata_F.defflag
			if PageLink_F == nil then lenke_F = '[[' .. Name_F .. ']]' else lenke_F = '[[' .. PageLink_F .. '|' .. Name_F .. ']]' end
			Col0_F = '|' .. Areas_F .. '\n'
			Col1_F = '|' .. lenke_F .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_F .. '|dok]])</small>\n'
			Col2_F = '|<code>' .. area_F .. '</code>\n'
			Col3_F = '|align="center"|[[Fil:' .. DefFlag_F .. '|33x27px]]'
			ColHeader0_F = '#'
			ColHeader1_F = 'Land'
			ColHeader2_F = 'Argument 1'
			ColHeader3_F = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_F = ''
				local HistColHeaderx_F = ''
				local i_F = 1
 				repeat
					if flagdata_F['histyear'..i_F] then
						Histyearx_F = flagdata_F['histyear'..i_F]
						Histflagx_F = flagdata_F['histflag'..i_F]
						if i_F > 1 then
							Histyearfrom_F = flagdata_F['histyear'..i_F-1]+1 .. '–'
							Histyearto_F = Histyearx_F
						else
							Histyearfrom_F = "<="
							Histyearto_F = Histyearx_F
						end
						HistColHeaderx_F = HistColHeaderx_F .. '\n!' .. Histyearfrom_F .. Histyearx_F
					else
						break
					end
					Histyears_F = Histyears_F .. '\n|align="center"|[[Fil:' .. Histflagx_F .. '|33x27px]]'
					i_F=i_F+1
				until not flagdata_F['histyear' .. i_F]
				
			 	-- Henter ut olympiske flagg
				local OLyears_F = ''
				local OLColHeaderx_F = ''
				local j_F = 1
 				repeat
					if flagdata_F['OLyear'..j_F] then
						OLyearx_F = flagdata_F['OLyear'..j_F]
						OLflagx_F = flagdata_F['OLflag'..j_F]
						OLColHeaderx_F = OLColHeaderx_F .. '\n!' .. OLyearx_F
					else
						break
					end
					OLyears_F = OLyears_F .. '\n|align="center"|[[Fil:' .. OLflagx_F .. '|33x27px]]'
					j_F=j_F+1
				until not flagdata_F['OLyear' .. j_F]
				if flagdata_F['histyeara'] then
					histyeara_F = flagdata_F['histyeara']
					histflaga_F = flagdata_F['histflaga']
					ColHeadera_F = '\n!' .. histyeara_F
					yearsa_F = '\n|align="center"|[[Fil:' .. histflaga_F .. '|33x27px]]'
				else
					yearsa_F = ""
					ColHeadera_F = ""
				end
				if flagdata_F['histyearb'] then
					histyearb_F = flagdata_F['histyearb']
					histflagb_F = flagdata_F['histflagb']
					ColHeaderb_F = '\n!' .. histyearb_F
					yearsb_F = '\n|align="center"|[[Fil:' .. histflagb_F .. '|33x27px]]'
				else
					yearsb_F = ""
					ColHeaderb_F = ""
				end
				if flagdata_F['histyearc'] then
					histyearc_F = flagdata_F['histyearc']
					histflagc_F = flagdata_F['histflagc']
					ColHeaderc_F = '\n!' .. histyearc_F
					yearsc_F = '\n|align="center"|[[Fil:' .. histflagc_F .. '|33x27px]]'
				else
					yearsc_F = ""
					ColHeaderc_F = ""
				end
				if flagdata_F['naval'] then
					naval_F = flagdata_F['naval']
					ColHeaderNaval_F = '\n!naval'
					navalflag_F = '\n|align="center"|[[Fil:' .. naval_F .. '|33x27px]]'
				else
					navalflag_F = ""
					ColHeaderNaval_F = ""
				end
				if flagdata_F['airforce'] then
					airforce_F = flagdata_F['airforce']
					ColHeaderAirforce_F = '\n!airforce'
					airforceflag_F = '\n|align="center"|[[Fil:' .. airforce_F .. '|33x27px]]'
				else
					airforceflag_F = ""
					ColHeaderAirforce_F = ""
				end
				if flagdata_F['coastguard'] then
					coastguard_F = flagdata_F['coastguard']
					ColHeaderCoastguard_F = '\n!coastguard'
					coastguardflag_F = '\n|align="center"|[[Fil:' .. coastguard_F .. '|33x27px]]'
				else
					coastguardflag_F = ""
					ColHeaderCoastguard_F = ""
				end
				if flagdata_F['sultanatet'] then
					sultanatet_F = flagdata_F['sultanatet']
					ColHeaderSultanatet_F = '\n!sultanatet'
					sultanatetflag_F = '\n|align="center"|[[Fil:' .. sultanatet_F .. '|33x27px]]'
				else
					sultanatetflag_F = ""
					ColHeaderSultanatet_F = ""
				end
				if flagdata_F['coa'] then
					coa_F = flagdata_F['coa']
					ColHeaderCoa_F = '\n!våpen'
					coaflag_F = '\n|align="center"|[[Fil:' .. coa_F .. '|33x27px]]'
				else
					coaflag_F = ""
					ColHeaderCoa_F = ""
				end
				if flagdata_F['shield'] then
					shield_F = flagdata_F['shield']
					ColHeaderShield_F = '\n!skjold'
					shieldflag_F = '\n|align="center"|[[Fil:' .. shield_F .. '|33x27px]]'
				else
					shieldflag_F = ""
					ColHeaderShield_F = ""
				end
				if flagdata_F['seal'] then
					seal_F = flagdata_F['seal']
					ColHeaderSeal_F = '\n!segl'
					sealflag_F = '\n|align="center"|[[Fil:' .. seal_F .. '|33x27px]]'
				else
					sealflag_F = ""
					ColHeaderSeal_F = ""
				end
				if flagdata_F['football'] then
					football_F = flagdata_F['football']
					ColHeaderFootball_F = '\n!fotball'
					footballflag_F = '\n|align="center"|[[Fil:' .. football_F .. '|33x27px]]'
				else
					footballflag_F = ""
					ColHeaderFootball_F = ""
				end
				if flagdata_F['OLfootball'] then
					olfootball_F = flagdata_F['OLfootball']
					ColHeaderOLFootball_F = '\n!OL (fotball)'
					olfootballflag_F = '\n|align="center"|[[Fil:' .. olfootball_F .. '|33x27px]]'
				else
					olfootballflag_F = ""
					ColHeaderOLFootball_F = ""
				end
			ColEnd_F = '\n|-\n'
			ColYear_F = coaflag_F .. shieldflag_F .. sealflag_F .. Histyears_F .. OLyears_F .. yearsa_F .. yearsb_F .. yearsc_F .. navalflag_F .. airforceflag_F .. coastguardflag_F
						.. sultanatetflag_F .. coaflag_F .. footballflag_F .. olfootballflag_F
			ColHeaderx_F = ColHeaderCoa_F .. ColHeaderShield_F .. ColHeaderSeal_F .. HistColHeaderx_F .. ColHeadera_F .. ColHeaderb_F .. ColHeaderc_F .. OLColHeaderx_F .. ColHeaderNaval_F ..
						ColHeaderAirforce_F .. ColHeaderCoastguard_F .. ColHeaderSultanatet_F .. ColHeaderCoa_F ..
						ColHeaderFootball_F .. ColHeaderOLFootball_F
			TableHeader_F = '\n' .. 
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_F .. '\n!' .. ColHeader1_F .. '\n!' .. ColHeader2_F .. '\n!' .. ColHeader3_F .. ColHeaderx_F .. '\n' ..
[=[|-
]=]
			TableBottom_F = '|}\n'
			row_F = Col0_F .. Col1_F .. Col2_F .. Col3_F .. ColYear_F .. ColEnd_F
			rows_F = rows_F .. row_F
			Table_F = TableHeader_F .. row_F .. TableBottom_F
			Tables_F = Tables_F .. Table_F
	end
	
	local Tables_G = ''
    local rows_G = ''
    local Areas_G = 0
	for area_G in mw.ustring.gmatch( text, '%[%"G%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_G = string.sub(area_G,3,-8)
    		
    		Areas_G = Areas_G+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_G
			local flagdata_G = require("Modul:Flagg/Masterdata").flagdata[area_G]
			local PageLink_G = flagdata_G.pagelink
			local Name_G = flagdata_G.name
			local DefFlag_G = flagdata_G.defflag
			if PageLink_G == nil then lenke_G = '[[' .. Name_G .. ']]' else lenke_G = '[[' .. PageLink_G .. '|' .. Name_G .. ']]' end
			Col0_G = '|' .. Areas_G .. '\n'
			Col1_G = '|' .. lenke_G .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_G .. '|dok]])</small>\n'
			Col2_G = '|<code>' .. area_G .. '</code>\n'
			Col3_G = '|align="center"|[[Fil:' .. DefFlag_G .. '|33x27px]]'
			ColHeader0_G = '#'
			ColHeader1_G = 'Land'
			ColHeader2_G = 'Argument 1'
			ColHeader3_G = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_G = ''
				local HistColHeaderx_G = ''
				local i_G = 1
 				repeat
					if flagdata_G['histyear'..i_G] then
						Histyearx_G = flagdata_G['histyear'..i_G]
						Histflagx_G = flagdata_G['histflag'..i_G]
						if i_G > 1 then
							Histyearfrom_G = flagdata_G['histyear'..i_G-1]+1 .. '–'
							Histyearto_G = Histyearx_G
						else
							Histyearfrom_G = "<="
							Histyearto_G = Histyearx_G
						end
						HistColHeaderx_G = HistColHeaderx_G .. '\n!' .. Histyearfrom_G .. Histyearx_G
					else
						break
					end
					Histyears_G = Histyears_G .. '\n|align="center"|[[Fil:' .. Histflagx_G .. '|33x27px]]'
					i_G=i_G+1
				until not flagdata_G['histyear' .. i_G]
				
			 	-- Henter ut olympiske flagg
				local OLyears_G = ''
				local OLColHeaderx_G = ''
				local j_G = 1
 				repeat
					if flagdata_G['OLyear'..j_G] then
						OLyearx_G = flagdata_G['OLyear'..j_G]
						OLflagx_G = flagdata_G['OLflag'..j_G]
						OLColHeaderx_G = OLColHeaderx_G .. '\n!' .. OLyearx_G
					else
						break
					end
					OLyears_G = OLyears_G .. '\n|align="center"|[[Fil:' .. OLflagx_G .. '|33x27px]]'
					j_G=j_G+1
				until not flagdata_G['OLyear' .. j_G]
				if flagdata_G['histyeara'] then
					histyeara_G = flagdata_G['histyeara']
					histflaga_G = flagdata_G['histflaga']
					ColHeadera_G = '\n!' .. histyeara_G
					yearsa_G = '\n|align="center"|[[Fil:' .. histflaga_G .. '|33x27px]]'
				else
					yearsa_G = ""
					ColHeadera_G = ""
				end
				if flagdata_G['histyearb'] then
					histyearb_G = flagdata_G['histyearb']
					histflagb_G = flagdata_G['histflagb']
					ColHeaderb_G = '\n!' .. histyearb_G
					yearsb_G = '\n|align="center"|[[Fil:' .. histflagb_G .. '|33x27px]]'
				else
					yearsb_G = ""
					ColHeaderb_G = ""
				end
				if flagdata_G['histyearc'] then
					histyearc_G = flagdata_G['histyearc']
					histflagc_G = flagdata_G['histflagc']
					ColHeaderc_G = '\n!' .. histyearc_G
					yearsc_G = '\n|align="center"|[[Fil:' .. histflagc_G .. '|33x27px]]'
				else
					yearsc_G = ""
					ColHeaderc_G = ""
				end
				if flagdata_G['naval'] then
					naval_G = flagdata_G['naval']
					ColHeaderNaval_G = '\n!naval'
					navalflag_G = '\n|align="center"|[[Fil:' .. naval_G .. '|33x27px]]'
				else
					navalflag_G = ""
					ColHeaderNaval_G = ""
				end
				if flagdata_G['airforce'] then
					airforce_G = flagdata_G['airforce']
					ColHeaderAirforce_G = '\n!airforce'
					airforceflag_G = '\n|align="center"|[[Fil:' .. airforce_G .. '|33x27px]]'
				else
					airforceflag_G = ""
					ColHeaderAirforce_G = ""
				end
				if flagdata_G['coastguard'] then
					coastguard_G = flagdata_G['coastguard']
					ColHeaderCoastguard_G = '\n!coastguard'
					coastguardflag_G = '\n|align="center"|[[Fil:' .. coastguard_G .. '|33x27px]]'
				else
					coastguardflag_G = ""
					ColHeaderCoastguard_G = ""
				end
				if flagdata_G['sultanatet'] then
					sultanatet_G = flagdata_G['sultanatet']
					ColHeaderSultanatet_G = '\n!sultanatet'
					sultanatetflag_G = '\n|align="center"|[[Fil:' .. sultanatet_G .. '|33x27px]]'
				else
					sultanatetflag_G = ""
					ColHeaderSultanatet_G = ""
				end
				if flagdata_G['coa'] then
					coa_G = flagdata_G['coa']
					ColHeaderCoa_G = '\n!våpen'
					coaflag_G = '\n|align="center"|[[Fil:' .. coa_G .. '|33x27px]]'
				else
					coaflag_G = ""
					ColHeaderCoa_G = ""
				end
				if flagdata_G['shield'] then
					shield_G = flagdata_G['shield']
					ColHeaderShield_G = '\n!skjold'
					shieldflag_G = '\n|align="center"|[[Fil:' .. shield_G .. '|33x27px]]'
				else
					shieldflag_G = ""
					ColHeaderShield_G = ""
				end
				if flagdata_G['seal'] then
					seal_G = flagdata_G['seal']
					ColHeaderSeal_G = '\n!segl'
					sealflag_G = '\n|align="center"|[[Fil:' .. seal_G .. '|33x27px]]'
				else
					sealflag_G = ""
					ColHeaderSeal_G = ""
				end
				if flagdata_G['football'] then
					football_G = flagdata_G['football']
					ColHeaderFootball_G = '\n!fotball'
					footballflag_G = '\n|align="center"|[[Fil:' .. football_G .. '|33x27px]]'
				else
					footballflag_G = ""
					ColHeaderFootball_G = ""
				end
				if flagdata_G['OLfootball'] then
					olfootball_G = flagdata_G['OLfootball']
					ColHeaderOLFootball_G = '\n!OL (fotball)'
					olfootballflag_G = '\n|align="center"|[[Fil:' .. olfootball_G .. '|33x27px]]'
				else
					olfootballflag_G = ""
					ColHeaderOLFootball_G = ""
				end
			ColEnd_G = '\n|-\n'
			ColYear_G = coaflag_G .. shieldflag_G .. sealflag_G .. Histyears_G .. OLyears_G .. yearsa_G .. yearsb_G .. yearsc_G .. navalflag_G .. airforceflag_G .. coastguardflag_G
						.. sultanatetflag_G .. coaflag_G .. footballflag_G .. olfootballflag_G
			ColHeaderx_G = ColHeaderCoa_G .. ColHeaderShield_G .. ColHeaderSeal_G .. HistColHeaderx_G .. ColHeadera_G .. ColHeaderb_G .. ColHeaderc_G .. OLColHeaderx_G .. ColHeaderNaval_G ..
						ColHeaderAirforce_G .. ColHeaderCoastguard_G .. ColHeaderSultanatet_G .. ColHeaderCoa_G ..
						ColHeaderFootball_G .. ColHeaderOLFootball_G
			TableHeader_G = '\n' .. 
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_G .. '\n!' .. ColHeader1_G .. '\n!' .. ColHeader2_G .. '\n!' .. ColHeader3_G .. ColHeaderx_G .. '\n' ..
[=[|-
]=]
			TableBottom_G = '|}\n'
			row_G = Col0_G .. Col1_G .. Col2_G .. Col3_G .. ColYear_G .. ColEnd_G
			rows_G = rows_G .. row_G
			Table_G = TableHeader_G .. row_G .. TableBottom_G
			Tables_G = Tables_G .. Table_G
	end
	
	local Tables_H = ''
    local rows_H = ''
    local Areas_H = 0
	for area_H in mw.ustring.gmatch( text, '%[%"H%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_H = string.sub(area_H,3,-8)
    		
    		Areas_H = Areas_H+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_H
			local flagdata_H = require("Modul:Flagg/Masterdata").flagdata[area_H]
			local PageLink_H = flagdata_H.pagelink
			local Name_H = flagdata_H.name
			local DefFlag_H = flagdata_H.defflag
			if PageLink_H == nil then lenke_H = '[[' .. Name_H .. ']]' else lenke_H = '[[' .. PageLink_H .. '|' .. Name_H .. ']]' end
			Col0_H = '|' .. Areas_H .. '\n'
			Col1_H = '|' .. lenke_H .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_H .. '|dok]])</small>\n'
			Col2_H = '|<code>' .. area_H .. '</code>\n'
			Col3_H = '|align="center"|[[Fil:' .. DefFlag_H .. '|33x27px]]'
			ColHeader0_H = '#'
			ColHeader1_H = 'Land'
			ColHeader2_H = 'Argument 1'
			ColHeader3_H = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_H = ''
				local HistColHeaderx_H = ''
				local i_H = 1
 				repeat
					if flagdata_H['histyear'..i_H] then
						Histyearx_H = flagdata_H['histyear'..i_H]
						Histflagx_H = flagdata_H['histflag'..i_H]
						if i_H > 1 then
							Histyearfrom_H = flagdata_H['histyear'..i_H-1]+1 .. '–'
							Histyearto_H = Histyearx_H
						else
							Histyearfrom_H = "<="
							Histyearto_H = Histyearx_H
						end
						HistColHeaderx_H = HistColHeaderx_H .. '\n!' .. Histyearfrom_H .. Histyearx_H
					else
						break
					end
					Histyears_H = Histyears_H .. '\n|align="center"|[[Fil:' .. Histflagx_H .. '|33x27px]]'
					i_H=i_H+1
				until not flagdata_H['histyear' .. i_H]
				
			 	-- Henter ut olympiske flagg
				local OLyears_H = ''
				local OLColHeaderx_H = ''
				local j_H = 1
 				repeat
					if flagdata_H['OLyear'..j_H] then
						OLyearx_H = flagdata_H['OLyear'..j_H]
						OLflagx_H = flagdata_H['OLflag'..j_H]
						OLColHeaderx_H = OLColHeaderx_H .. '\n!' .. OLyearx_H
					else
						break
					end
					OLyears_H = OLyears_H .. '\n|align="center"|[[Fil:' .. OLflagx_H .. '|33x27px]]'
					j_H=j_H+1
				until not flagdata_H['OLyear' .. j_H]
				if flagdata_H['histyeara'] then
					histyeara_H = flagdata_H['histyeara']
					histflaga_H = flagdata_H['histflaga']
					ColHeadera_H = '\n!' .. histyeara_H
					yearsa_H = '\n|align="center"|[[Fil:' .. histflaga_H .. '|33x27px]]'
				else
					yearsa_H = ""
					ColHeadera_H = ""
				end
				if flagdata_H['histyearb'] then
					histyearb_H = flagdata_H['histyearb']
					histflagb_H = flagdata_H['histflagb']
					ColHeaderb_H = '\n!' .. histyearb_H
					yearsb_H = '\n|align="center"|[[Fil:' .. histflagb_H .. '|33x27px]]'
				else
					yearsb_H = ""
					ColHeaderb_H = ""
				end
				if flagdata_H['histyearc'] then
					histyearc_H = flagdata_H['histyearc']
					histflagc_H = flagdata_H['histflagc']
					ColHeaderc_H = '\n!' .. histyearc_H
					yearsc_H = '\n|align="center"|[[Fil:' .. histflagc_H .. '|33x27px]]'
				else
					yearsc_H = ""
					ColHeaderc_H = ""
				end
				if flagdata_H['naval'] then
					naval_H = flagdata_H['naval']
					ColHeaderNaval_H = '\n!naval'
					navalflag_H = '\n|align="center"|[[Fil:' .. naval_H .. '|33x27px]]'
				else
					navalflag_H = ""
					ColHeaderNaval_H = ""
				end
				if flagdata_H['airforce'] then
					airforce_H = flagdata_H['airforce']
					ColHeaderAirforce_H = '\n!airforce'
					airforceflag_H = '\n|align="center"|[[Fil:' .. airforce_H .. '|33x27px]]'
				else
					airforceflag_H = ""
					ColHeaderAirforce_H = ""
				end
				if flagdata_H['coastguard'] then
					coastguard_H = flagdata_H['coastguard']
					ColHeaderCoastguard_H = '\n!coastguard'
					coastguardflag_H = '\n|align="center"|[[Fil:' .. coastguard_H .. '|33x27px]]'
				else
					coastguardflag_H = ""
					ColHeaderCoastguard_H = ""
				end
				if flagdata_H['sultanatet'] then
					sultanatet_H = flagdata_H['sultanatet']
					ColHeaderSultanatet_H = '\n!sultanatet'
					sultanatetflag_H = '\n|align="center"|[[Fil:' .. sultanatet_H .. '|33x27px]]'
				else
					sultanatetflag_H = ""
					ColHeaderSultanatet_H = ""
				end
				if flagdata_H['coa'] then
					coa_H = flagdata_H['coa']
					ColHeaderCoa_H = '\n!våpen'
					coaflag_H = '\n|align="center"|[[Fil:' .. coa_H .. '|33x27px]]'
				else
					coaflag_H = ""
					ColHeaderCoa_H = ""
				end
				if flagdata_H['shield'] then
					shield_H = flagdata_H['shield']
					ColHeaderShield_H = '\n!skjold'
					shieldflag_H = '\n|align="center"|[[Fil:' .. shield_H .. '|33x27px]]'
				else
					shieldflag_H = ""
					ColHeaderShield_H = ""
				end
				if flagdata_H['seal'] then
					seal_H = flagdata_H['seal']
					ColHeaderSeal_H = '\n!segl'
					sealflag_H = '\n|align="center"|[[Fil:' .. seal_H .. '|33x27px]]'
				else
					sealflag_H = ""
					ColHeaderSeal_H = ""
				end
				if flagdata_H['football'] then
					football_H = flagdata_H['football']
					ColHeaderFootball_H = '\n!fotball'
					footballflag_H = '\n|align="center"|[[Fil:' .. football_H .. '|33x27px]]'
				else
					footballflag_H = ""
					ColHeaderFootball_H = ""
				end
				if flagdata_H['OLfootball'] then
					olfootball_H = flagdata_H['OLfootball']
					ColHeaderOLFootball_H = '\n!OL (fotball)'
					olfootballflag_H = '\n|align="center"|[[Fil:' .. olfootball_H .. '|33x27px]]'
				else
					olfootballflag_H = ""
					ColHeaderOLFootball_H = ""
				end
			ColEnd_H = '\n|-\n'
			ColYear_H = coaflag_H .. shieldflag_H .. sealflag_H .. Histyears_H .. OLyears_H .. yearsa_H .. yearsb_H .. yearsc_H .. navalflag_H .. airforceflag_H .. coastguardflag_H
						.. sultanatetflag_H .. coaflag_H .. footballflag_H .. olfootballflag_H
			ColHeaderx_H = ColHeaderCoa_H .. ColHeaderShield_H .. ColHeaderSeal_H .. HistColHeaderx_H .. ColHeadera_H .. ColHeaderb_H .. ColHeaderc_H .. OLColHeaderx_H .. ColHeaderNaval_H ..
						ColHeaderAirforce_H .. ColHeaderCoastguard_H .. ColHeaderSultanatet_H .. ColHeaderCoa_H ..
						ColHeaderFootball_H .. ColHeaderOLFootball_H
			TableHeader_H = '\n' .. 
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_H .. '\n!' .. ColHeader1_H .. '\n!' .. ColHeader2_H .. '\n!' .. ColHeader3_H .. ColHeaderx_H .. '\n' ..
[=[|-
]=]
			TableBottom_H = '|}\n'
			row_H = Col0_H .. Col1_H .. Col2_H .. Col3_H .. ColYear_H .. ColEnd_H
			rows_H = rows_H .. row_H
			Table_H = TableHeader_H .. row_H .. TableBottom_H
			Tables_H = Tables_H .. Table_H
	end
	
	local Tables_I = ''
    local rows_I = ''
    local Areas_I = 0
	for area_I in mw.ustring.gmatch( text, '%[%"I%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_I = string.sub(area_I,3,-8)
    		
    		Areas_I = Areas_I+1
    		if area_I == "Ikke-eksisterende" then Areas_I = Areas_I-1 end
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_I
			local flagdata_I = require("Modul:Flagg/Masterdata").flagdata[area_I]
			local PageLink_I = flagdata_I.pagelink
			local Name_I = flagdata_I.name
			local DefFlag_I = flagdata_I.defflag
			if PageLink_I == nil then lenke_I = '[[' .. Name_I .. ']]' else lenke_I = '[[' .. PageLink_I .. '|' .. Name_I .. ']]' end
			Col0_I = '|' .. Areas_I .. '\n'
			Col1_I = '|' .. lenke_I .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_I .. '|dok]])</small>\n'
			Col2_I = '|<code>' .. area_I .. '</code>\n'
			Col3_I = '|align="center"|[[Fil:' .. DefFlag_I .. '|33x27px]]'
			ColHeader0_I = '#'
			ColHeader1_I = 'Land'
			ColHeader2_I = 'Argument 1'
			ColHeader3_I = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_I = ''
				local HistColHeaderx_I = ''
				local i_I = 1
 				repeat
					if flagdata_I['histyear'..i_I] then
						Histyearx_I = flagdata_I['histyear'..i_I]
						Histflagx_I = flagdata_I['histflag'..i_I]
						if i_I > 1 then
							Histyearfrom_I = flagdata_I['histyear'..i_I-1]+1 .. '–'
							Histyearto_I = Histyearx_I
						else
							Histyearfrom_I = "<="
							Histyearto_I = Histyearx_I
						end
						HistColHeaderx_I = HistColHeaderx_I .. '\n!' .. Histyearfrom_I .. Histyearx_I
					else
						break
					end
					Histyears_I = Histyears_I .. '\n|align="center"|[[Fil:' .. Histflagx_I .. '|33x27px]]'
					i_I=i_I+1
				until not flagdata_I['histyear' .. i_I]
				
			 	-- Henter ut olympiske flagg
				local OLyears_I = ''
				local OLColHeaderx_I = ''
				local j_I = 1
 				repeat
					if flagdata_I['OLyear'..j_I] then
						OLyearx_I = flagdata_I['OLyear'..j_I]
						OLflagx_I = flagdata_I['OLflag'..j_I]
						OLColHeaderx_I = OLColHeaderx_I .. '\n!' .. OLyearx_I
					else
						break
					end
					OLyears_I = OLyears_I .. '\n|align="center"|[[Fil:' .. OLflagx_I .. '|33x27px]]'
					j_I=j_I+1
				until not flagdata_I['OLyear' .. j_I]
				if flagdata_I['histyeara'] then
					histyeara_I = flagdata_I['histyeara']
					histflaga_I = flagdata_I['histflaga']
					ColHeadera_I = '\n!' .. histyeara_I
					yearsa_I = '\n|align="center"|[[Fil:' .. histflaga_I .. '|33x27px]]'
				else
					yearsa_I = ""
					ColHeadera_I = ""
				end
				if flagdata_I['histyearb'] then
					histyearb_I = flagdata_I['histyearb']
					histflagb_I = flagdata_I['histflagb']
					ColHeaderb_I = '\n!' .. histyearb_I
					yearsb_I = '\n|align="center"|[[Fil:' .. histflagb_I .. '|33x27px]]'
				else
					yearsb_I = ""
					ColHeaderb_I = ""
				end
				if flagdata_I['histyearc'] then
					histyearc_I = flagdata_I['histyearc']
					histflagc_I = flagdata_I['histflagc']
					ColHeaderc_I = '\n!' .. histyearc_I
					yearsc_I = '\n|align="center"|[[Fil:' .. histflagc_I .. '|33x27px]]'
				else
					yearsc_I = ""
					ColHeaderc_I = ""
				end
				if flagdata_I['naval'] then
					naval_I = flagdata_I['naval']
					ColHeaderNaval_I = '\n!naval'
					navalflag_I = '\n|align="center"|[[Fil:' .. naval_I .. '|33x27px]]'
				else
					navalflag_I = ""
					ColHeaderNaval_I = ""
				end
				if flagdata_I['airforce'] then
					airforce_I = flagdata_I['airforce']
					ColHeaderAirforce_I = '\n!airforce'
					airforceflag_I = '\n|align="center"|[[Fil:' .. airforce_I .. '|33x27px]]'
				else
					airforceflag_I = ""
					ColHeaderAirforce_I = ""
				end
				if flagdata_I['coastguard'] then
					coastguard_I = flagdata_I['coastguard']
					ColHeaderCoastguard_I = '\n!coastguard'
					coastguardflag_I = '\n|align="center"|[[Fil:' .. coastguard_I .. '|33x27px]]'
				else
					coastguardflag_I = ""
					ColHeaderCoastguard_I = ""
				end
				if flagdata_I['sultanatet'] then
					sultanatet_I = flagdata_I['sultanatet']
					ColHeaderSultanatet_I = '\n!sultanatet'
					sultanatetflag_I = '\n|align="center"|[[Fil:' .. sultanatet_I .. '|33x27px]]'
				else
					sultanatetflag_I = ""
					ColHeaderSultanatet_I = ""
				end
				if flagdata_I['coa'] then
					coa_I = flagdata_I['coa']
					ColHeaderCoa_I = '\n!våpen'
					coaflag_I = '\n|align="center"|[[Fil:' .. coa_I .. '|33x27px]]'
				else
					coaflag_I = ""
					ColHeaderCoa_I = ""
				end
				if flagdata_I['shield'] then
					shield_I = flagdata_I['shield']
					ColHeaderShield_I = '\n!skjold'
					shieldflag_I = '\n|align="center"|[[Fil:' .. shield_I .. '|33x27px]]'
				else
					shieldflag_I = ""
					ColHeaderShield_I = ""
				end
				if flagdata_I['seal'] then
					seal_I = flagdata_I['seal']
					ColHeaderSeal_I = '\n!segl'
					sealflag_I = '\n|align="center"|[[Fil:' .. seal_I .. '|33x27px]]'
				else
					sealflag_I = ""
					ColHeaderSeal_I = ""
				end
				if flagdata_I['football'] then
					football_I = flagdata_I['football']
					ColHeaderFootball_I = '\n!fotball'
					footballflag_I = '\n|align="center"|[[Fil:' .. football_I .. '|33x27px]]'
				else
					footballflag_I = ""
					ColHeaderFootball_I = ""
				end
				if flagdata_I['OLfootball'] then
					olfootball_I = flagdata_I['OLfootball']
					ColHeaderOLFootball_I = '\n!OL (fotball)'
					olfootballflag_I = '\n|align="center"|[[Fil:' .. olfootball_I .. '|33x27px]]'
				else
					olfootballflag_I = ""
					ColHeaderOLFootball_I = ""
				end
			ColEnd_I = '\n|-\n'
			ColYear_I = coaflag_I .. shieldflag_I .. sealflag_I .. Histyears_I .. OLyears_I .. yearsa_I .. yearsb_I .. yearsc_I .. navalflag_I .. airforceflag_I .. coastguardflag_I
						.. sultanatetflag_I .. coaflag_I .. footballflag_I .. olfootballflag_I
			ColHeaderx_I = ColHeaderCoa_I .. ColHeaderShield_I .. ColHeaderSeal_I .. HistColHeaderx_I .. ColHeadera_I .. ColHeaderb_I .. ColHeaderc_I .. OLColHeaderx_I .. ColHeaderNaval_I ..
						ColHeaderAirforce_I .. ColHeaderCoastguard_I .. ColHeaderSultanatet_I .. ColHeaderCoa_I ..
						ColHeaderFootball_I .. ColHeaderOLFootball_I
			TableHeader_I = '\n' .. 
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_I .. '\n!' .. ColHeader1_I .. '\n!' .. ColHeader2_I .. '\n!' .. ColHeader3_I .. ColHeaderx_I .. '\n' ..
[=[|-
]=]
			TableBottom_I = '|}\n'
			row_I = Col0_I .. Col1_I .. Col2_I .. Col3_I .. ColYear_I .. ColEnd_I
			rows_I = rows_I .. row_I
			if area_I == "Ikke-eksisterende" then Table_I = "" else Table_I = TableHeader_I .. row_I .. TableBottom_I end
			Tables_I = Tables_I .. Table_I
	end
	
	local Tables_J = ''
    local rows_J = ''
    local Areas_J = 0
	for area_J in mw.ustring.gmatch( text, '%[%"J%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_J = string.sub(area_J,3,-8)
    		
    		Areas_J = Areas_J+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_J
			local flagdata_J = require("Modul:Flagg/Masterdata").flagdata[area_J]
			local PageLink_J = flagdata_J.pagelink
			local Name_J = flagdata_J.name
			local DefFlag_J = flagdata_J.defflag
			if PageLink_J == nil then lenke_J = '[[' .. Name_J .. ']]' else lenke_J = '[[' .. PageLink_J .. '|' .. Name_J .. ']]' end
			Col0_J = '|' .. Areas_J .. '\n'
			Col1_J = '|' .. lenke_J .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_J .. '|dok]])</small>\n'
			Col2_J = '|<code>' .. area_J .. '</code>\n'
			Col3_J = '|align="center"|[[Fil:' .. DefFlag_J .. '|33x27px]]'
			ColHeader0_J = '#'
			ColHeader1_J = 'Land'
			ColHeader2_J = 'Argument 1'
			ColHeader3_J = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_J = ''
				local HistColHeaderx_J = ''
				local i_J = 1
 				repeat
					if flagdata_J['histyear'..i_J] then
						Histyearx_J = flagdata_J['histyear'..i_J]
						Histflagx_J = flagdata_J['histflag'..i_J]
						if i_J > 1 then
							Histyearfrom_J = flagdata_J['histyear'..i_J-1]+1 .. '–'
							Histyearto_J = Histyearx_J
						else
							Histyearfrom_J = "<="
							Histyearto_J = Histyearx_J
						end
						HistColHeaderx_J = HistColHeaderx_J .. '\n!' .. Histyearfrom_J .. Histyearx_J
					else
						break
					end
					Histyears_J = Histyears_J .. '\n|align="center"|[[Fil:' .. Histflagx_J .. '|33x27px]]'
					i_J=i_J+1
				until not flagdata_J['histyear' .. i_J]
				
			 	-- Henter ut olympiske flagg
				local OLyears_J = ''
				local OLColHeaderx_J = ''
				local j_J = 1
 				repeat
					if flagdata_J['OLyear'..j_J] then
						OLyearx_J = flagdata_J['OLyear'..j_J]
						OLflagx_J = flagdata_J['OLflag'..j_J]
						OLColHeaderx_J = OLColHeaderx_J .. '\n!' .. OLyearx_J
					else
						break
					end
					OLyears_J = OLyears_J .. '\n|align="center"|[[Fil:' .. OLflagx_J .. '|33x27px]]'
					j_J=j_J+1
				until not flagdata_J['OLyear' .. j_J]
				if flagdata_J['histyeara'] then
					histyeara_J = flagdata_J['histyeara']
					histflaga_J = flagdata_J['histflaga']
					ColHeadera_J = '\n!' .. histyeara_J
					yearsa_J = '\n|align="center"|[[Fil:' .. histflaga_J .. '|33x27px]]'
				else
					yearsa_J = ""
					ColHeadera_J = ""
				end
				if flagdata_J['histyearb'] then
					histyearb_J = flagdata_J['histyearb']
					histflagb_J = flagdata_J['histflagb']
					ColHeaderb_J = '\n!' .. histyearb_J
					yearsb_J = '\n|align="center"|[[Fil:' .. histflagb_J .. '|33x27px]]'
				else
					yearsb_J = ""
					ColHeaderb_J = ""
				end
				if flagdata_J['histyearc'] then
					histyearc_J = flagdata_J['histyearc']
					histflagc_J = flagdata_J['histflagc']
					ColHeaderc_J = '\n!' .. histyearc_J
					yearsc_J = '\n|align="center"|[[Fil:' .. histflagc_J .. '|33x27px]]'
				else
					yearsc_J = ""
					ColHeaderc_J = ""
				end
				if flagdata_J['naval'] then
					naval_J = flagdata_J['naval']
					ColHeaderNaval_J = '\n!naval'
					navalflag_J = '\n|align="center"|[[Fil:' .. naval_J .. '|33x27px]]'
				else
					navalflag_J = ""
					ColHeaderNaval_J = ""
				end
				if flagdata_J['airforce'] then
					airforce_J = flagdata_J['airforce']
					ColHeaderAirforce_J = '\n!airforce'
					airforceflag_J = '\n|align="center"|[[Fil:' .. airforce_J .. '|33x27px]]'
				else
					airforceflag_J = ""
					ColHeaderAirforce_J = ""
				end
				if flagdata_J['coastguard'] then
					coastguard_J = flagdata_J['coastguard']
					ColHeaderCoastguard_J = '\n!coastguard'
					coastguardflag_J = '\n|align="center"|[[Fil:' .. coastguard_J .. '|33x27px]]'
				else
					coastguardflag_J = ""
					ColHeaderCoastguard_J = ""
				end
				if flagdata_J['sultanatet'] then
					sultanatet_J = flagdata_J['sultanatet']
					ColHeaderSultanatet_J = '\n!sultanatet'
					sultanatetflag_J = '\n|align="center"|[[Fil:' .. sultanatet_J .. '|33x27px]]'
				else
					sultanatetflag_J = ""
					ColHeaderSultanatet_J = ""
				end
				if flagdata_J['coa'] then
					coa_J = flagdata_J['coa']
					ColHeaderCoa_J = '\n!våpen'
					coaflag_J = '\n|align="center"|[[Fil:' .. coa_J .. '|33x27px]]'
				else
					coaflag_J = ""
					ColHeaderCoa_J = ""
				end
				if flagdata_J['shield'] then
					shield_J = flagdata_J['shield']
					ColHeaderShield_J = '\n!skjold'
					shieldflag_J = '\n|align="center"|[[Fil:' .. shield_J .. '|33x27px]]'
				else
					shieldflag_J = ""
					ColHeaderShield_J = ""
				end
				if flagdata_J['seal'] then
					seal_J = flagdata_J['seal']
					ColHeaderSeal_J = '\n!segl'
					sealflag_J = '\n|align="center"|[[Fil:' .. seal_J .. '|33x27px]]'
				else
					sealflag_J = ""
					ColHeaderSeal_J = ""
				end
				if flagdata_J['football'] then
					football_J = flagdata_J['football']
					ColHeaderFootball_J = '\n!fotball'
					footballflag_J = '\n|align="center"|[[Fil:' .. football_J .. '|33x27px]]'
				else
					footballflag_J = ""
					ColHeaderFootball_J = ""
				end
				if flagdata_J['OLfootball'] then
					olfootball_J = flagdata_J['OLfootball']
					ColHeaderOLFootball_J = '\n!OL (fotball)'
					olfootballflag_J = '\n|align="center"|[[Fil:' .. olfootball_J .. '|33x27px]]'
				else
					olfootballflag_J = ""
					ColHeaderOLFootball_J = ""
				end
			ColEnd_J = '\n|-\n'
			ColYear_J = coaflag_J .. shieldflag_J .. sealflag_J .. Histyears_J .. OLyears_J .. yearsa_J .. yearsb_J .. yearsc_J .. navalflag_J .. airforceflag_J .. coastguardflag_J
						.. sultanatetflag_J .. coaflag_J .. footballflag_J .. olfootballflag_J
			ColHeaderx_J = ColHeaderCoa_J .. ColHeaderShield_J .. ColHeaderSeal_J .. HistColHeaderx_J .. ColHeadera_J .. ColHeaderb_J .. ColHeaderc_J .. OLColHeaderx_J .. ColHeaderNaval_J ..
						ColHeaderAirforce_J .. ColHeaderCoastguard_J .. ColHeaderSultanatet_J .. ColHeaderCoa_J ..
						ColHeaderFootball_J .. ColHeaderOLFootball_J
			TableHeader_J = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_J .. '\n!' .. ColHeader1_J .. '\n!' .. ColHeader2_J .. '\n!' .. ColHeader3_J .. ColHeaderx_J .. '\n' ..
[=[|-
]=]
			TableBottom_J = '|}\n'
			row_J = Col0_J .. Col1_J .. Col2_J .. Col3_J .. ColYear_J .. ColEnd_J
			rows_J = rows_J .. row_J
			Table_J = TableHeader_J .. row_J .. TableBottom_J
			Tables_J = Tables_J .. Table_J
	end
	
	local Tables_K = ''
    local rows_K = ''
    local Areas_K = 0
	for area_K in mw.ustring.gmatch( text, '%[%"K%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_K = string.sub(area_K,3,-8)
    		
    		Areas_K = Areas_K+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_K
			local flagdata_K = require("Modul:Flagg/Masterdata").flagdata[area_K]
			local PageLink_K = flagdata_K.pagelink
			local Name_K = flagdata_K.name
			local DefFlag_K = flagdata_K.defflag
			if PageLink_K == nil then lenke_K = '[[' .. Name_K .. ']]' else lenke_K = '[[' .. PageLink_K .. '|' .. Name_K .. ']]' end
			Col0_K = '|' .. Areas_K .. '\n'
			Col1_K = '|' .. lenke_K .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_K .. '|dok]])</small>\n'
			Col2_K = '|<code>' .. area_K .. '</code>\n'
			Col3_K = '|align="center"|[[Fil:' .. DefFlag_K .. '|33x27px]]'
			ColHeader0_K = '#'
			ColHeader1_K = 'Land'
			ColHeader2_K = 'Argument 1'
			ColHeader3_K = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_K = ''
				local HistColHeaderx_K = ''
				local i_K = 1
 				repeat
					if flagdata_K['histyear'..i_K] then
						Histyearx_K = flagdata_K['histyear'..i_K]
						Histflagx_K = flagdata_K['histflag'..i_K]
						if i_K > 1 then
							Histyearfrom_K = flagdata_K['histyear'..i_K-1]+1 .. '–'
							Histyearto_K = Histyearx_K
						else
							Histyearfrom_K = "<="
							Histyearto_K = Histyearx_K
						end
						HistColHeaderx_K = HistColHeaderx_K .. '\n!' .. Histyearfrom_K .. Histyearx_K
					else
						break
					end
					Histyears_K = Histyears_K .. '\n|align="center"|[[Fil:' .. Histflagx_K .. '|33x27px]]'
					i_K=i_K+1
				until not flagdata_K['histyear' .. i_K]
				
			 	-- Henter ut olympiske flagg
				local OLyears_K = ''
				local OLColHeaderx_K = ''
				local j_K = 1
 				repeat
					if flagdata_K['OLyear'..j_K] then
						OLyearx_K = flagdata_K['OLyear'..j_K]
						OLflagx_K = flagdata_K['OLflag'..j_K]
						OLColHeaderx_K = OLColHeaderx_K .. '\n!' .. OLyearx_K
					else
						break
					end
					OLyears_K = OLyears_K .. '\n|align="center"|[[Fil:' .. OLflagx_K .. '|33x27px]]'
					j_K=j_K+1
				until not flagdata_K['OLyear' .. j_K]
				if flagdata_K['histyeara'] then
					histyeara_K = flagdata_K['histyeara']
					histflaga_K = flagdata_K['histflaga']
					ColHeadera_K = '\n!' .. histyeara_K
					yearsa_K = '\n|align="center"|[[Fil:' .. histflaga_K .. '|33x27px]]'
				else
					yearsa_K = ""
					ColHeadera_K = ""
				end
				if flagdata_K['histyearb'] then
					histyearb_K = flagdata_K['histyearb']
					histflagb_K = flagdata_K['histflagb']
					ColHeaderb_K = '\n!' .. histyearb_K
					yearsb_K = '\n|align="center"|[[Fil:' .. histflagb_K .. '|33x27px]]'
				else
					yearsb_K = ""
					ColHeaderb_K = ""
				end
				if flagdata_K['histyearc'] then
					histyearc_K = flagdata_K['histyearc']
					histflagc_K = flagdata_K['histflagc']
					ColHeaderc_K = '\n!' .. histyearc_K
					yearsc_K = '\n|align="center"|[[Fil:' .. histflagc_K .. '|33x27px]]'
				else
					yearsc_K = ""
					ColHeaderc_K = ""
				end
				if flagdata_K['naval'] then
					naval_K = flagdata_K['naval']
					ColHeaderNaval_K = '\n!naval'
					navalflag_K = '\n|align="center"|[[Fil:' .. naval_K .. '|33x27px]]'
				else
					navalflag_K = ""
					ColHeaderNaval_K = ""
				end
				if flagdata_K['airforce'] then
					airforce_K = flagdata_K['airforce']
					ColHeaderAirforce_K = '\n!airforce'
					airforceflag_K = '\n|align="center"|[[Fil:' .. airforce_K .. '|33x27px]]'
				else
					airforceflag_K = ""
					ColHeaderAirforce_K = ""
				end
				if flagdata_K['coastguard'] then
					coastguard_K = flagdata_K['coastguard']
					ColHeaderCoastguard_K = '\n!coastguard'
					coastguardflag_K = '\n|align="center"|[[Fil:' .. coastguard_K .. '|33x27px]]'
				else
					coastguardflag_K = ""
					ColHeaderCoastguard_K = ""
				end
				if flagdata_K['sultanatet'] then
					sultanatet_K = flagdata_K['sultanatet']
					ColHeaderSultanatet_K = '\n!sultanatet'
					sultanatetflag_K = '\n|align="center"|[[Fil:' .. sultanatet_K .. '|33x27px]]'
				else
					sultanatetflag_K = ""
					ColHeaderSultanatet_K = ""
				end
				if flagdata_K['coa'] then
					coa_K = flagdata_K['coa']
					ColHeaderCoa_K = '\n!våpen'
					coaflag_K = '\n|align="center"|[[Fil:' .. coa_K .. '|33x27px]]'
				else
					coaflag_K = ""
					ColHeaderCoa_K = ""
				end
				if flagdata_K['shield'] then
					shield_K = flagdata_K['shield']
					ColHeaderShield_K = '\n!skjold'
					shieldflag_K = '\n|align="center"|[[Fil:' .. shield_K .. '|33x27px]]'
				else
					shieldflag_K = ""
					ColHeaderShield_K = ""
				end
				if flagdata_K['seal'] then
					seal_K = flagdata_K['seal']
					ColHeaderSeal_K = '\n!segl'
					sealflag_K = '\n|align="center"|[[Fil:' .. seal_K .. '|33x27px]]'
				else
					sealflag_K = ""
					ColHeaderSeal_K = ""
				end
				if flagdata_K['football'] then
					football_K = flagdata_K['football']
					ColHeaderFootball_K = '\n!fotball'
					footballflag_K = '\n|align="center"|[[Fil:' .. football_K .. '|33x27px]]'
				else
					footballflag_K = ""
					ColHeaderFootball_K = ""
				end
				if flagdata_K['OLfootball'] then
					olfootball_K = flagdata_K['OLfootball']
					ColHeaderOLFootball_K = '\n!OL (fotball)'
					olfootballflag_K = '\n|align="center"|[[Fil:' .. olfootball_K .. '|33x27px]]'
				else
					olfootballflag_K = ""
					ColHeaderOLFootball_K = ""
				end
			ColEnd_K = '\n|-\n'
			ColYear_K = coaflag_K .. shieldflag_K .. sealflag_K .. Histyears_K .. OLyears_K .. yearsa_K .. yearsb_K .. yearsc_K .. navalflag_K .. airforceflag_K .. coastguardflag_K
						.. sultanatetflag_K .. coaflag_K .. footballflag_K .. olfootballflag_K
			ColHeaderx_K = ColHeaderCoa_K .. ColHeaderShield_K .. ColHeaderSeal_K .. HistColHeaderx_K .. ColHeadera_K .. ColHeaderb_K .. ColHeaderc_K .. OLColHeaderx_K .. ColHeaderNaval_K ..
						ColHeaderAirforce_K .. ColHeaderCoastguard_K .. ColHeaderSultanatet_K .. ColHeaderCoa_K ..
						ColHeaderFootball_K .. ColHeaderOLFootball_K
			TableHeader_K = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_K .. '\n!' .. ColHeader1_K .. '\n!' .. ColHeader2_K .. '\n!' .. ColHeader3_K .. ColHeaderx_K .. '\n' ..
[=[|-
]=]
			TableBottom_K = '|}\n'
			row_K = Col0_K .. Col1_K .. Col2_K .. Col3_K .. ColYear_K .. ColEnd_K
			rows_K = rows_K .. row_K
			Table_K = TableHeader_K .. row_K .. TableBottom_K
			Tables_K = Tables_K .. Table_K
	end
	
	local Tables_L = ''
    local rows_L = ''
    local Areas_L = 0
	for area_L in mw.ustring.gmatch( text, '%[%"L%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_L = string.sub(area_L,3,-8)
    		
    		Areas_L = Areas_L+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_L
			local flagdata_L = require("Modul:Flagg/Masterdata").flagdata[area_L]
			local PageLink_L = flagdata_L.pagelink
			local Name_L = flagdata_L.name
			local DefFlag_L = flagdata_L.defflag
			if PageLink_L == nil then lenke_L = '[[' .. Name_L .. ']]' else lenke_L = '[[' .. PageLink_L .. '|' .. Name_L .. ']]' end
			Col0_L = '|' .. Areas_L .. '\n'
			Col1_L = '|' .. lenke_L .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_L .. '|dok]])</small>\n'
			Col2_L = '|<code>' .. area_L .. '</code>\n'
			Col3_L = '|align="center"|[[Fil:' .. DefFlag_L .. '|33x27px]]'
			ColHeader0_L = '#'
			ColHeader1_L = 'Land'
			ColHeader2_L = 'Argument 1'
			ColHeader3_L = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_L = ''
				local HistColHeaderx_L = ''
				local i_L = 1
 				repeat
					if flagdata_L['histyear'..i_L] then
						Histyearx_L = flagdata_L['histyear'..i_L]
						Histflagx_L = flagdata_L['histflag'..i_L]
						if i_L > 1 then
							Histyearfrom_L = flagdata_L['histyear'..i_L-1]+1 .. '–'
							Histyearto_L = Histyearx_L
						else
							Histyearfrom_L = "<="
							Histyearto_L = Histyearx_L
						end
						HistColHeaderx_L = HistColHeaderx_L .. '\n!' .. Histyearfrom_L .. Histyearx_L
					else
						break
					end
					Histyears_L = Histyears_L .. '\n|align="center"|[[Fil:' .. Histflagx_L .. '|33x27px]]'
					i_L=i_L+1
				until not flagdata_L['histyear' .. i_L]
				
			 	-- Henter ut olympiske flagg
				local OLyears_L = ''
				local OLColHeaderx_L = ''
				local j_L = 1
 				repeat
					if flagdata_L['OLyear'..j_L] then
						OLyearx_L = flagdata_L['OLyear'..j_L]
						OLflagx_L = flagdata_L['OLflag'..j_L]
						OLColHeaderx_L = OLColHeaderx_L .. '\n!' .. OLyearx_L
					else
						break
					end
					OLyears_L = OLyears_L .. '\n|align="center"|[[Fil:' .. OLflagx_L .. '|33x27px]]'
					j_L=j_L+1
				until not flagdata_L['OLyear' .. j_L]
				if flagdata_L['histyeara'] then
					histyeara_L = flagdata_L['histyeara']
					histflaga_L = flagdata_L['histflaga']
					ColHeadera_L = '\n!' .. histyeara_L
					yearsa_L = '\n|align="center"|[[Fil:' .. histflaga_L .. '|33x27px]]'
				else
					yearsa_L = ""
					ColHeadera_L = ""
				end
				if flagdata_L['histyearb'] then
					histyearb_L = flagdata_L['histyearb']
					histflagb_L = flagdata_L['histflagb']
					ColHeaderb_L = '\n!' .. histyearb_L
					yearsb_L = '\n|align="center"|[[Fil:' .. histflagb_L .. '|33x27px]]'
				else
					yearsb_L = ""
					ColHeaderb_L = ""
				end
				if flagdata_L['histyearc'] then
					histyearc_L = flagdata_L['histyearc']
					histflagc_L = flagdata_L['histflagc']
					ColHeaderc_L = '\n!' .. histyearc_L
					yearsc_L = '\n|align="center"|[[Fil:' .. histflagc_L .. '|33x27px]]'
				else
					yearsc_L = ""
					ColHeaderc_L = ""
				end
				if flagdata_L['naval'] then
					naval_L = flagdata_L['naval']
					ColHeaderNaval_L = '\n!naval'
					navalflag_L = '\n|align="center"|[[Fil:' .. naval_L .. '|33x27px]]'
				else
					navalflag_L = ""
					ColHeaderNaval_L = ""
				end
				if flagdata_L['airforce'] then
					airforce_L = flagdata_L['airforce']
					ColHeaderAirforce_L = '\n!airforce'
					airforceflag_L = '\n|align="center"|[[Fil:' .. airforce_L .. '|33x27px]]'
				else
					airforceflag_L = ""
					ColHeaderAirforce_L = ""
				end
				if flagdata_L['coastguard'] then
					coastguard_L = flagdata_L['coastguard']
					ColHeaderCoastguard_L = '\n!coastguard'
					coastguardflag_L = '\n|align="center"|[[Fil:' .. coastguard_L .. '|33x27px]]'
				else
					coastguardflag_L = ""
					ColHeaderCoastguard_L = ""
				end
				if flagdata_L['sultanatet'] then
					sultanatet_L = flagdata_L['sultanatet']
					ColHeaderSultanatet_L = '\n!sultanatet'
					sultanatetflag_L = '\n|align="center"|[[Fil:' .. sultanatet_L .. '|33x27px]]'
				else
					sultanatetflag_L = ""
					ColHeaderSultanatet_L = ""
				end
				if flagdata_L['coa'] then
					coa_L = flagdata_L['coa']
					ColHeaderCoa_L = '\n!våpen'
					coaflag_L = '\n|align="center"|[[Fil:' .. coa_L .. '|33x27px]]'
				else
					coaflag_L = ""
					ColHeaderCoa_L = ""
				end
				if flagdata_L['shield'] then
					shield_L = flagdata_L['shield']
					ColHeaderShield_L = '\n!skjold'
					shieldflag_L = '\n|align="center"|[[Fil:' .. shield_L .. '|33x27px]]'
				else
					shieldflag_L = ""
					ColHeaderShield_L = ""
				end
				if flagdata_L['seal'] then
					seal_L = flagdata_L['seal']
					ColHeaderSeal_L = '\n!segl'
					sealflag_L = '\n|align="center"|[[Fil:' .. seal_L .. '|33x27px]]'
				else
					sealflag_L = ""
					ColHeaderSeal_L = ""
				end
				if flagdata_L['football'] then
					football_L = flagdata_L['football']
					ColHeaderFootball_L = '\n!fotball'
					footballflag_L = '\n|align="center"|[[Fil:' .. football_L .. '|33x27px]]'
				else
					footballflag_L = ""
					ColHeaderFootball_L = ""
				end
				if flagdata_L['OLfootball'] then
					olfootball_L = flagdata_L['OLfootball']
					ColHeaderOLFootball_L = '\n!OL (fotball)'
					olfootballflag_L = '\n|align="center"|[[Fil:' .. olfootball_L .. '|33x27px]]'
				else
					olfootballflag_L = ""
					ColHeaderOLFootball_L = ""
				end
			ColEnd_L = '\n|-\n'
			ColYear_L = coaflag_L .. shieldflag_L .. sealflag_L .. Histyears_L .. OLyears_L .. yearsa_L .. yearsb_L .. yearsc_L .. navalflag_L .. airforceflag_L .. coastguardflag_L
						.. sultanatetflag_L .. coaflag_L .. footballflag_L .. olfootballflag_L
			ColHeaderx_L = ColHeaderCoa_L .. ColHeaderShield_L .. ColHeaderSeal_L .. HistColHeaderx_L .. ColHeadera_L .. ColHeaderb_L .. ColHeaderc_L .. OLColHeaderx_L .. ColHeaderNaval_L ..
						ColHeaderAirforce_L .. ColHeaderCoastguard_L .. ColHeaderSultanatet_L .. ColHeaderCoa_L ..
						ColHeaderFootball_L .. ColHeaderOLFootball_L
			TableHeader_L = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_L .. '\n!' .. ColHeader1_L .. '\n!' .. ColHeader2_L .. '\n!' .. ColHeader3_L .. ColHeaderx_L .. '\n' ..
[=[|-
]=]
			TableBottom_L = '|}\n'
			row_L = Col0_L .. Col1_L .. Col2_L .. Col3_L .. ColYear_L .. ColEnd_L
			rows_L = rows_L .. row_L
			Table_L = TableHeader_L .. row_L .. TableBottom_L
			Tables_L = Tables_L .. Table_L
	end
	
	local Tables_M = ''
    local rows_M = ''
    local Areas_M = 0
	for area_M in mw.ustring.gmatch( text, '%[%"M%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_M = string.sub(area_M,3,-8)
    		
    		Areas_M = Areas_M+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_M
			local flagdata_M = require("Modul:Flagg/Masterdata").flagdata[area_M]
			local PageLink_M = flagdata_M.pagelink
			local Name_M = flagdata_M.name
			local DefFlag_M = flagdata_M.defflag
			if PageLink_M == nil then lenke_M = '[[' .. Name_M .. ']]' else lenke_M = '[[' .. PageLink_M .. '|' .. Name_M .. ']]' end
			Col0_M = '|' .. Areas_M .. '\n'
			Col1_M = '|' .. lenke_M .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_M .. '|dok]])</small>\n'
			Col2_M = '|<code>' .. area_M .. '</code>\n'
			Col3_M = '|align="center"|[[Fil:' .. DefFlag_M .. '|33x27px]]'
			ColHeader0_M = '#'
			ColHeader1_M = 'Land'
			ColHeader2_M = 'Argument 1'
			ColHeader3_M = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_M = ''
				local HistColHeaderx_M = ''
				local i_M = 1
 				repeat
					if flagdata_M['histyear'..i_M] then
						Histyearx_M = flagdata_M['histyear'..i_M]
						Histflagx_M = flagdata_M['histflag'..i_M]
						if i_M > 1 then
							Histyearfrom_M = flagdata_M['histyear'..i_M-1]+1 .. '–'
							Histyearto_M = Histyearx_M
						else
							Histyearfrom_M = "<="
							Histyearto_M = Histyearx_M
						end
						HistColHeaderx_M = HistColHeaderx_M .. '\n!' .. Histyearfrom_M .. Histyearx_M
					else
						break
					end
					Histyears_M = Histyears_M .. '\n|align="center"|[[Fil:' .. Histflagx_M .. '|33x27px]]'
					i_M=i_M+1
				until not flagdata_M['histyear' .. i_M]
				
			 	-- Henter ut olympiske flagg
				local OLyears_M = ''
				local OLColHeaderx_M = ''
				local j_M = 1
 				repeat
					if flagdata_M['OLyear'..j_M] then
						OLyearx_M = flagdata_M['OLyear'..j_M]
						OLflagx_M = flagdata_M['OLflag'..j_M]
						OLColHeaderx_M = OLColHeaderx_M .. '\n!' .. OLyearx_M
					else
						break
					end
					OLyears_M = OLyears_M .. '\n|align="center"|[[Fil:' .. OLflagx_M .. '|33x27px]]'
					j_M=j_M+1
				until not flagdata_M['OLyear' .. j_M]
				if flagdata_M['histyeara'] then
					histyeara_M = flagdata_M['histyeara']
					histflaga_M = flagdata_M['histflaga']
					ColHeadera_M = '\n!' .. histyeara_M
					yearsa_M = '\n|align="center"|[[Fil:' .. histflaga_M .. '|33x27px]]'
				else
					yearsa_M = ""
					ColHeadera_M = ""
				end
				if flagdata_M['histyearb'] then
					histyearb_M = flagdata_M['histyearb']
					histflagb_M = flagdata_M['histflagb']
					ColHeaderb_M = '\n!' .. histyearb_M
					yearsb_M = '\n|align="center"|[[Fil:' .. histflagb_M .. '|33x27px]]'
				else
					yearsb_M = ""
					ColHeaderb_M = ""
				end
				if flagdata_M['histyearc'] then
					histyearc_M = flagdata_M['histyearc']
					histflagc_M = flagdata_M['histflagc']
					ColHeaderc_M = '\n!' .. histyearc_M
					yearsc_M = '\n|align="center"|[[Fil:' .. histflagc_M .. '|33x27px]]'
				else
					yearsc_M = ""
					ColHeaderc_M = ""
				end
				if flagdata_M['naval'] then
					naval_M = flagdata_M['naval']
					ColHeaderNaval_M = '\n!naval'
					navalflag_M = '\n|align="center"|[[Fil:' .. naval_M .. '|33x27px]]'
				else
					navalflag_M = ""
					ColHeaderNaval_M = ""
				end
				if flagdata_M['airforce'] then
					airforce_M = flagdata_M['airforce']
					ColHeaderAirforce_M = '\n!airforce'
					airforceflag_M = '\n|align="center"|[[Fil:' .. airforce_M .. '|33x27px]]'
				else
					airforceflag_M = ""
					ColHeaderAirforce_M = ""
				end
				if flagdata_M['coastguard'] then
					coastguard_M = flagdata_M['coastguard']
					ColHeaderCoastguard_M = '\n!coastguard'
					coastguardflag_M = '\n|align="center"|[[Fil:' .. coastguard_M .. '|33x27px]]'
				else
					coastguardflag_M = ""
					ColHeaderCoastguard_M = ""
				end
				if flagdata_M['sultanatet'] then
					sultanatet_M = flagdata_M['sultanatet']
					ColHeaderSultanatet_M = '\n!sultanatet'
					sultanatetflag_M = '\n|align="center"|[[Fil:' .. sultanatet_M .. '|33x27px]]'
				else
					sultanatetflag_M = ""
					ColHeaderSultanatet_M = ""
				end
				if flagdata_M['coa'] then
					coa_M = flagdata_M['coa']
					ColHeaderCoa_M = '\n!våpen'
					coaflag_M = '\n|align="center"|[[Fil:' .. coa_M .. '|33x27px]]'
				else
					coaflag_M = ""
					ColHeaderCoa_M = ""
				end
				if flagdata_M['shield'] then
					shield_M = flagdata_M['shield']
					ColHeaderShield_M = '\n!skjold'
					shieldflag_M = '\n|align="center"|[[Fil:' .. shield_M .. '|33x27px]]'
				else
					shieldflag_M = ""
					ColHeaderShield_M = ""
				end
				if flagdata_M['seal'] then
					seal_M = flagdata_M['seal']
					ColHeaderSeal_M = '\n!segl'
					sealflag_M = '\n|align="center"|[[Fil:' .. seal_M .. '|33x27px]]'
				else
					sealflag_M = ""
					ColHeaderSeal_M = ""
				end
				if flagdata_M['football'] then
					football_M = flagdata_M['football']
					ColHeaderFootball_M = '\n!fotball'
					footballflag_M = '\n|align="center"|[[Fil:' .. football_M .. '|33x27px]]'
				else
					footballflag_M = ""
					ColHeaderFootball_M = ""
				end
				if flagdata_M['OLfootball'] then
					olfootball_M = flagdata_M['OLfootball']
					ColHeaderOLFootball_M = '\n!OL (fotball)'
					olfootballflag_M = '\n|align="center"|[[Fil:' .. olfootball_M .. '|33x27px]]'
				else
					olfootballflag_M = ""
					ColHeaderOLFootball_M = ""
				end
			ColEnd_M = '\n|-\n'
			ColYear_M = coaflag_M .. shieldflag_M .. sealflag_M .. Histyears_M .. OLyears_M .. yearsa_M .. yearsb_M .. yearsc_M .. navalflag_M .. airforceflag_M .. coastguardflag_M
						.. sultanatetflag_M .. coaflag_M .. footballflag_M .. olfootballflag_M
			ColHeaderx_M = ColHeaderCoa_M .. ColHeaderShield_M .. ColHeaderSeal_M .. HistColHeaderx_M .. ColHeadera_M .. ColHeaderb_M .. ColHeaderc_M .. OLColHeaderx_M .. ColHeaderNaval_M ..
						ColHeaderAirforce_M .. ColHeaderCoastguard_M .. ColHeaderSultanatet_M .. ColHeaderCoa_M ..
						ColHeaderFootball_M .. ColHeaderOLFootball_M
			TableHeader_M = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_M .. '\n!' .. ColHeader1_M .. '\n!' .. ColHeader2_M .. '\n!' .. ColHeader3_M .. ColHeaderx_M .. '\n' ..
[=[|-
]=]
			TableBottom_M = '|}\n'
			row_M = Col0_M .. Col1_M .. Col2_M .. Col3_M .. ColYear_M .. ColEnd_M
			rows_M = rows_M .. row_M
			Table_M = TableHeader_M .. row_M .. TableBottom_M
			Tables_M = Tables_M .. Table_M
	end
	
	local Tables_N = ''
    local rows_N = ''
    local Areas_N = 0
	for area_N in mw.ustring.gmatch( text, '%[%"N%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_N = string.sub(area_N,3,-8)
    		
    		Areas_N = Areas_N+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_N
			local flagdata_N = require("Modul:Flagg/Masterdata").flagdata[area_N]
			local PageLink_N = flagdata_N.pagelink
			local Name_N = flagdata_N.name
			local DefFlag_N = flagdata_N.defflag
			if PageLink_N == nil then lenke_N = '[[' .. Name_N .. ']]' else lenke_N = '[[' .. PageLink_N .. '|' .. Name_N .. ']]' end
			Col0_N = '|' .. Areas_N .. '\n'
			Col1_N = '|' .. lenke_N .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_N .. '|dok]])</small>\n'
			Col2_N = '|<code>' .. area_N .. '</code>\n'
			Col3_N = '|align="center"|[[Fil:' .. DefFlag_N .. '|33x27px]]'
			ColHeader0_N = '#'
			ColHeader1_N = 'Land'
			ColHeader2_N = 'Argument 1'
			ColHeader3_N = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_N = ''
				local HistColHeaderx_N = ''
				local i_N = 1
 				repeat
					if flagdata_N['histyear'..i_N] then
						Histyearx_N = flagdata_N['histyear'..i_N]
						Histflagx_N = flagdata_N['histflag'..i_N]
						if i_N > 1 then
							Histyearfrom_N = flagdata_N['histyear'..i_N-1]+1 .. '–'
							Histyearto_N = Histyearx_N
						else
							Histyearfrom_N = "<="
							Histyearto_N = Histyearx_N
						end
						HistColHeaderx_N = HistColHeaderx_N .. '\n!' .. Histyearfrom_N .. Histyearx_N
					else
						break
					end
					Histyears_N = Histyears_N .. '\n|align="center"|[[Fil:' .. Histflagx_N .. '|33x27px]]'
					i_N=i_N+1
				until not flagdata_N['histyear' .. i_N]
				
			 	-- Henter ut olympiske flagg
				local OLyears_N = ''
				local OLColHeaderx_N = ''
				local j_N = 1
 				repeat
					if flagdata_N['OLyear'..j_N] then
						OLyearx_N = flagdata_N['OLyear'..j_N]
						OLflagx_N = flagdata_N['OLflag'..j_N]
						OLColHeaderx_N = OLColHeaderx_N .. '\n!' .. OLyearx_N
					else
						break
					end
					OLyears_N = OLyears_N .. '\n|align="center"|[[Fil:' .. OLflagx_N .. '|33x27px]]'
					j_N=j_N+1
				until not flagdata_N['OLyear' .. j_N]
				if flagdata_N['histyeara'] then
					histyeara_N = flagdata_N['histyeara']
					histflaga_N = flagdata_N['histflaga']
					ColHeadera_N = '\n!' .. histyeara_N
					yearsa_N = '\n|align="center"|[[Fil:' .. histflaga_N .. '|33x27px]]'
				else
					yearsa_N = ""
					ColHeadera_N = ""
				end
				if flagdata_N['histyearb'] then
					histyearb_N = flagdata_N['histyearb']
					histflagb_N = flagdata_N['histflagb']
					ColHeaderb_N = '\n!' .. histyearb_N
					yearsb_N = '\n|align="center"|[[Fil:' .. histflagb_N .. '|33x27px]]'
				else
					yearsb_N = ""
					ColHeaderb_N = ""
				end
				if flagdata_N['histyearc'] then
					histyearc_N = flagdata_N['histyearc']
					histflagc_N = flagdata_N['histflagc']
					ColHeaderc_N = '\n!' .. histyearc_N
					yearsc_N = '\n|align="center"|[[Fil:' .. histflagc_N .. '|33x27px]]'
				else
					yearsc_N = ""
					ColHeaderc_N = ""
				end
				if flagdata_N['naval'] then
					naval_N = flagdata_N['naval']
					ColHeaderNaval_N = '\n!naval'
					navalflag_N = '\n|align="center"|[[Fil:' .. naval_N .. '|33x27px]]'
				else
					navalflag_N = ""
					ColHeaderNaval_N = ""
				end
				if flagdata_N['airforce'] then
					airforce_N = flagdata_N['airforce']
					ColHeaderAirforce_N = '\n!airforce'
					airforceflag_N = '\n|align="center"|[[Fil:' .. airforce_N .. '|33x27px]]'
				else
					airforceflag_N = ""
					ColHeaderAirforce_N = ""
				end
				if flagdata_N['coastguard'] then
					coastguard_N = flagdata_N['coastguard']
					ColHeaderCoastguard_N = '\n!coastguard'
					coastguardflag_N = '\n|align="center"|[[Fil:' .. coastguard_N .. '|33x27px]]'
				else
					coastguardflag_N = ""
					ColHeaderCoastguard_N = ""
				end
				if flagdata_N['sultanatet'] then
					sultanatet_N = flagdata_N['sultanatet']
					ColHeaderSultanatet_N = '\n!sultanatet'
					sultanatetflag_N = '\n|align="center"|[[Fil:' .. sultanatet_N .. '|33x27px]]'
				else
					sultanatetflag_N = ""
					ColHeaderSultanatet_N = ""
				end
				if flagdata_N['coa'] then
					coa_N = flagdata_N['coa']
					ColHeaderCoa_N = '\n!våpen'
					coaflag_N = '\n|align="center"|[[Fil:' .. coa_N .. '|33x27px]]'
				else
					coaflag_N = ""
					ColHeaderCoa_N = ""
				end
				if flagdata_N['shield'] then
					shield_N = flagdata_N['shield']
					ColHeaderShield_N = '\n!skjold'
					shieldflag_N = '\n|align="center"|[[Fil:' .. shield_N .. '|33x27px]]'
				else
					shieldflag_N = ""
					ColHeaderShield_N = ""
				end
				if flagdata_N['seal'] then
					seal_N = flagdata_N['seal']
					ColHeaderSeal_N = '\n!segl'
					sealflag_N = '\n|align="center"|[[Fil:' .. seal_N .. '|33x27px]]'
				else
					sealflag_N = ""
					ColHeaderSeal_N = ""
				end
				if flagdata_N['football'] then
					football_N = flagdata_N['football']
					ColHeaderFootball_N = '\n!fotball'
					footballflag_N = '\n|align="center"|[[Fil:' .. football_N .. '|33x27px]]'
				else
					footballflag_N = ""
					ColHeaderFootball_N = ""
				end
				if flagdata_N['OLfootball'] then
					olfootball_N = flagdata_N['OLfootball']
					ColHeaderOLFootball_N = '\n!OL (fotball)'
					olfootballflag_N = '\n|align="center"|[[Fil:' .. olfootball_N .. '|33x27px]]'
				else
					olfootballflag_N = ""
					ColHeaderOLFootball_N = ""
				end
			ColEnd_N = '\n|-\n'
			ColYear_N = coaflag_N .. shieldflag_N .. sealflag_N .. Histyears_N .. OLyears_N .. yearsa_N .. yearsb_N .. yearsc_N .. navalflag_N .. airforceflag_N .. coastguardflag_N
						.. sultanatetflag_N .. coaflag_N .. footballflag_N .. olfootballflag_N
			ColHeaderx_N = ColHeaderCoa_N .. ColHeaderShield_N .. ColHeaderSeal_N .. HistColHeaderx_N .. ColHeadera_N .. ColHeaderb_N .. ColHeaderc_N .. OLColHeaderx_N .. ColHeaderNaval_N ..
						ColHeaderAirforce_N .. ColHeaderCoastguard_N .. ColHeaderSultanatet_N .. ColHeaderCoa_N ..
						ColHeaderFootball_N .. ColHeaderOLFootball_N
			TableHeader_N = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_N .. '\n!' .. ColHeader1_N .. '\n!' .. ColHeader2_N .. '\n!' .. ColHeader3_N .. ColHeaderx_N .. '\n' ..
[=[|-
]=]
			TableBottom_N = '|}\n'
			row_N = Col0_N .. Col1_N .. Col2_N .. Col3_N .. ColYear_N .. ColEnd_N
			rows_N = rows_N .. row_N
			Table_N = TableHeader_N .. row_N .. TableBottom_N
			Tables_N = Tables_N .. Table_N
	end
	
	local Tables_O = ''
    local rows_O = ''
    local Areas_O = 0
	for area_O in mw.ustring.gmatch( text, '%[%"O%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_O = string.sub(area_O,3,-8)
    		
    		Areas_O = Areas_O+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_O
			local flagdata_O = require("Modul:Flagg/Masterdata").flagdata[area_O]
			local PageLink_O = flagdata_O.pagelink
			local Name_O = flagdata_O.name
			local DefFlag_O = flagdata_O.defflag
			if PageLink_O == nil then lenke_O = '[[' .. Name_O .. ']]' else lenke_O = '[[' .. PageLink_O .. '|' .. Name_O .. ']]' end
			Col0_O = '|' .. Areas_O .. '\n'
			Col1_O = '|' .. lenke_O .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_O .. '|dok]])</small>\n'
			Col2_O = '|<code>' .. area_O .. '</code>\n'
			Col3_O = '|align="center"|[[Fil:' .. DefFlag_O .. '|33x27px]]'
			ColHeader0_O = '#'
			ColHeader1_O = 'Land'
			ColHeader2_O = 'Argument 1'
			ColHeader3_O = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_O = ''
				local HistColHeaderx_O = ''
				local i_O = 1
 				repeat
					if flagdata_O['histyear'..i_O] then
						Histyearx_O = flagdata_O['histyear'..i_O]
						Histflagx_O = flagdata_O['histflag'..i_O]
						if i_O > 1 then
							Histyearfrom_O = flagdata_O['histyear'..i_O-1]+1 .. '–'
							Histyearto_O = Histyearx_O
						else
							Histyearfrom_O = "<="
							Histyearto_O = Histyearx_O
						end
						HistColHeaderx_O = HistColHeaderx_O .. '\n!' .. Histyearfrom_O .. Histyearx_O
					else
						break
					end
					Histyears_O = Histyears_O .. '\n|align="center"|[[Fil:' .. Histflagx_O .. '|33x27px]]'
					i_O=i_O+1
				until not flagdata_O['histyear' .. i_O]
				
			 	-- Henter ut olympiske flagg
				local OLyears_O = ''
				local OLColHeaderx_O = ''
				local j_O = 1
 				repeat
					if flagdata_O['OLyear'..j_O] then
						OLyearx_O = flagdata_O['OLyear'..j_O]
						OLflagx_O = flagdata_O['OLflag'..j_O]
						OLColHeaderx_O = OLColHeaderx_O .. '\n!' .. OLyearx_O
					else
						break
					end
					OLyears_O = OLyears_O .. '\n|align="center"|[[Fil:' .. OLflagx_O .. '|33x27px]]'
					j_O=j_O+1
				until not flagdata_O['OLyear' .. j_O]
				if flagdata_O['histyeara'] then
					histyeara_O = flagdata_O['histyeara']
					histflaga_O = flagdata_O['histflaga']
					ColHeadera_O = '\n!' .. histyeara_O
					yearsa_O = '\n|align="center"|[[Fil:' .. histflaga_O .. '|33x27px]]'
				else
					yearsa_O = ""
					ColHeadera_O = ""
				end
				if flagdata_O['histyearb'] then
					histyearb_O = flagdata_O['histyearb']
					histflagb_O = flagdata_O['histflagb']
					ColHeaderb_O = '\n!' .. histyearb_O
					yearsb_O = '\n|align="center"|[[Fil:' .. histflagb_O .. '|33x27px]]'
				else
					yearsb_O = ""
					ColHeaderb_O = ""
				end
				if flagdata_O['histyearc'] then
					histyearc_O = flagdata_O['histyearc']
					histflagc_O = flagdata_O['histflagc']
					ColHeaderc_O = '\n!' .. histyearc_O
					yearsc_O = '\n|align="center"|[[Fil:' .. histflagc_O .. '|33x27px]]'
				else
					yearsc_O = ""
					ColHeaderc_O = ""
				end
				if flagdata_O['naval'] then
					naval_O = flagdata_O['naval']
					ColHeaderNaval_O = '\n!naval'
					navalflag_O = '\n|align="center"|[[Fil:' .. naval_O .. '|33x27px]]'
				else
					navalflag_O = ""
					ColHeaderNaval_O = ""
				end
				if flagdata_O['airforce'] then
					airforce_O = flagdata_O['airforce']
					ColHeaderAirforce_O = '\n!airforce'
					airforceflag_O = '\n|align="center"|[[Fil:' .. airforce_O .. '|33x27px]]'
				else
					airforceflag_O = ""
					ColHeaderAirforce_O = ""
				end
				if flagdata_O['coastguard'] then
					coastguard_O = flagdata_O['coastguard']
					ColHeaderCoastguard_O = '\n!coastguard'
					coastguardflag_O = '\n|align="center"|[[Fil:' .. coastguard_O .. '|33x27px]]'
				else
					coastguardflag_O = ""
					ColHeaderCoastguard_O = ""
				end
				if flagdata_O['sultanatet'] then
					sultanatet_O = flagdata_O['sultanatet']
					ColHeaderSultanatet_O = '\n!sultanatet'
					sultanatetflag_O = '\n|align="center"|[[Fil:' .. sultanatet_O .. '|33x27px]]'
				else
					sultanatetflag_O = ""
					ColHeaderSultanatet_O = ""
				end
				if flagdata_O['coa'] then
					coa_O = flagdata_O['coa']
					ColHeaderCoa_O = '\n!våpen'
					coaflag_O = '\n|align="center"|[[Fil:' .. coa_O .. '|33x27px]]'
				else
					coaflag_O = ""
					ColHeaderCoa_O = ""
				end
				if flagdata_O['shield'] then
					shield_O = flagdata_O['shield']
					ColHeaderShield_O = '\n!skjold'
					shieldflag_O = '\n|align="center"|[[Fil:' .. shield_O .. '|33x27px]]'
				else
					shieldflag_O = ""
					ColHeaderShield_O = ""
				end
				if flagdata_O['seal'] then
					seal_O = flagdata_O['seal']
					ColHeaderSeal_O = '\n!segl'
					sealflag_O = '\n|align="center"|[[Fil:' .. seal_O .. '|33x27px]]'
				else
					sealflag_O = ""
					ColHeaderSeal_O = ""
				end
				if flagdata_O['football'] then
					football_O = flagdata_O['football']
					ColHeaderFootball_O = '\n!fotball'
					footballflag_O = '\n|align="center"|[[Fil:' .. football_O .. '|33x27px]]'
				else
					footballflag_O = ""
					ColHeaderFootball_O = ""
				end
				if flagdata_O['OLfootball'] then
					olfootball_O = flagdata_O['OLfootball']
					ColHeaderOLFootball_O = '\n!OL (fotball)'
					olfootballflag_O = '\n|align="center"|[[Fil:' .. olfootball_O .. '|33x27px]]'
				else
					olfootballflag_O = ""
					ColHeaderOLFootball_O = ""
				end
			ColEnd_O = '\n|-\n'
			ColYear_O = coaflag_O .. shieldflag_O .. sealflag_O .. Histyears_O .. OLyears_O .. yearsa_O .. yearsb_O .. yearsc_O .. navalflag_O .. airforceflag_O .. coastguardflag_O
						.. sultanatetflag_O .. coaflag_O .. footballflag_O .. olfootballflag_O
			ColHeaderx_O = ColHeaderCoa_O .. ColHeaderShield_O .. ColHeaderSeal_O .. HistColHeaderx_O .. ColHeadera_O .. ColHeaderb_O .. ColHeaderc_O .. OLColHeaderx_O .. ColHeaderNaval_O ..
						ColHeaderAirforce_O .. ColHeaderCoastguard_O .. ColHeaderSultanatet_O .. ColHeaderCoa_O ..
						ColHeaderFootball_O .. ColHeaderOLFootball_O
			TableHeader_O = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_O .. '\n!' .. ColHeader1_O .. '\n!' .. ColHeader2_O .. '\n!' .. ColHeader3_O .. ColHeaderx_O .. '\n' ..
[=[|-
]=]
			TableBottom_O = '|}\n'
			row_O = Col0_O .. Col1_O .. Col2_O .. Col3_O .. ColYear_O .. ColEnd_O
			rows_O = rows_O .. row_O
			Table_O = TableHeader_O .. row_O .. TableBottom_O
			Tables_O = Tables_O .. Table_O
	end
	
	local Tables_P = ''
    local rows_P = ''
    local Areas_P = 0
	for area_P in mw.ustring.gmatch( text, '%[%"P%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_P = string.sub(area_P,3,-8)
    		
    		Areas_P = Areas_P+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_P
			local flagdata_P = require("Modul:Flagg/Masterdata").flagdata[area_P]
			local PageLink_P = flagdata_P.pagelink
			local Name_P = flagdata_P.name
			local DefFlag_P = flagdata_P.defflag
			if PageLink_P == nil then lenke_P = '[[' .. Name_P .. ']]' else lenke_P = '[[' .. PageLink_P .. '|' .. Name_P .. ']]' end
			Col0_P = '|' .. Areas_P .. '\n'
			Col1_P = '|' .. lenke_P .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_P .. '|dok]])</small>\n'
			Col2_P = '|<code>' .. area_P .. '</code>\n'
			Col3_P = '|align="center"|[[Fil:' .. DefFlag_P .. '|33x27px]]'
			ColHeader0_P = '#'
			ColHeader1_P = 'Land'
			ColHeader2_P = 'Argument 1'
			ColHeader3_P = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_P = ''
				local HistColHeaderx_P = ''
				local i_P = 1
 				repeat
					if flagdata_P['histyear'..i_P] then
						Histyearx_P = flagdata_P['histyear'..i_P]
						Histflagx_P = flagdata_P['histflag'..i_P]
						if i_P > 1 then
							Histyearfrom_P = flagdata_P['histyear'..i_P-1]+1 .. '–'
							Histyearto_P = Histyearx_P
						else
							Histyearfrom_P = "<="
							Histyearto_P = Histyearx_P
						end
						HistColHeaderx_P = HistColHeaderx_P .. '\n!' .. Histyearfrom_P .. Histyearx_P
					else
						break
					end
					Histyears_P = Histyears_P .. '\n|align="center"|[[Fil:' .. Histflagx_P .. '|33x27px]]'
					i_P=i_P+1
				until not flagdata_P['histyear' .. i_P]
				
			 	-- Henter ut olympiske flagg
				local OLyears_P = ''
				local OLColHeaderx_P = ''
				local j_P = 1
 				repeat
					if flagdata_P['OLyear'..j_P] then
						OLyearx_P = flagdata_P['OLyear'..j_P]
						OLflagx_P = flagdata_P['OLflag'..j_P]
						OLColHeaderx_P = OLColHeaderx_P .. '\n!' .. OLyearx_P
					else
						break
					end
					OLyears_P = OLyears_P .. '\n|align="center"|[[Fil:' .. OLflagx_P .. '|33x27px]]'
					j_P=j_P+1
				until not flagdata_P['OLyear' .. j_P]
				if flagdata_P['histyeara'] then
					histyeara_P = flagdata_P['histyeara']
					histflaga_P = flagdata_P['histflaga']
					ColHeadera_P = '\n!' .. histyeara_P
					yearsa_P = '\n|align="center"|[[Fil:' .. histflaga_P .. '|33x27px]]'
				else
					yearsa_P = ""
					ColHeadera_P = ""
				end
				if flagdata_P['histyearb'] then
					histyearb_P = flagdata_P['histyearb']
					histflagb_P = flagdata_P['histflagb']
					ColHeaderb_P = '\n!' .. histyearb_P
					yearsb_P = '\n|align="center"|[[Fil:' .. histflagb_P .. '|33x27px]]'
				else
					yearsb_P = ""
					ColHeaderb_P = ""
				end
				if flagdata_P['histyearc'] then
					histyearc_P = flagdata_P['histyearc']
					histflagc_P = flagdata_P['histflagc']
					ColHeaderc_P = '\n!' .. histyearc_P
					yearsc_P = '\n|align="center"|[[Fil:' .. histflagc_P .. '|33x27px]]'
				else
					yearsc_P = ""
					ColHeaderc_P = ""
				end
				if flagdata_P['naval'] then
					naval_P = flagdata_P['naval']
					ColHeaderNaval_P = '\n!naval'
					navalflag_P = '\n|align="center"|[[Fil:' .. naval_P .. '|33x27px]]'
				else
					navalflag_P = ""
					ColHeaderNaval_P = ""
				end
				if flagdata_P['airforce'] then
					airforce_P = flagdata_P['airforce']
					ColHeaderAirforce_P = '\n!airforce'
					airforceflag_P = '\n|align="center"|[[Fil:' .. airforce_P .. '|33x27px]]'
				else
					airforceflag_P = ""
					ColHeaderAirforce_P = ""
				end
				if flagdata_P['coastguard'] then
					coastguard_P = flagdata_P['coastguard']
					ColHeaderCoastguard_P = '\n!coastguard'
					coastguardflag_P = '\n|align="center"|[[Fil:' .. coastguard_P .. '|33x27px]]'
				else
					coastguardflag_P = ""
					ColHeaderCoastguard_P = ""
				end
				if flagdata_P['sultanatet'] then
					sultanatet_P = flagdata_P['sultanatet']
					ColHeaderSultanatet_P = '\n!sultanatet'
					sultanatetflag_P = '\n|align="center"|[[Fil:' .. sultanatet_P .. '|33x27px]]'
				else
					sultanatetflag_P = ""
					ColHeaderSultanatet_P = ""
				end
				if flagdata_P['coa'] then
					coa_P = flagdata_P['coa']
					ColHeaderCoa_P = '\n!våpen'
					coaflag_P = '\n|align="center"|[[Fil:' .. coa_P .. '|33x27px]]'
				else
					coaflag_P = ""
					ColHeaderCoa_P = ""
				end
				if flagdata_P['shield'] then
					shield_P = flagdata_P['shield']
					ColHeaderShield_P = '\n!skjold'
					shieldflag_P = '\n|align="center"|[[Fil:' .. shield_P .. '|33x27px]]'
				else
					shieldflag_P = ""
					ColHeaderShield_P = ""
				end
				if flagdata_P['seal'] then
					seal_P = flagdata_P['seal']
					ColHeaderSeal_P = '\n!segl'
					sealflag_P = '\n|align="center"|[[Fil:' .. seal_P .. '|33x27px]]'
				else
					sealflag_P = ""
					ColHeaderSeal_P = ""
				end
				if flagdata_P['football'] then
					football_P = flagdata_P['football']
					ColHeaderFootball_P = '\n!fotball'
					footballflag_P = '\n|align="center"|[[Fil:' .. football_P .. '|33x27px]]'
				else
					footballflag_P = ""
					ColHeaderFootball_P = ""
				end
				if flagdata_P['OLfootball'] then
					olfootball_P = flagdata_P['OLfootball']
					ColHeaderOLFootball_P = '\n!OL (fotball)'
					olfootballflag_P = '\n|align="center"|[[Fil:' .. olfootball_P .. '|33x27px]]'
				else
					olfootballflag_P = ""
					ColHeaderOLFootball_P = ""
				end
			ColEnd_P = '\n|-\n'
			ColYear_P = coaflag_P .. shieldflag_P .. sealflag_P .. Histyears_P .. OLyears_P .. yearsa_P .. yearsb_P .. yearsc_P .. navalflag_P .. airforceflag_P .. coastguardflag_P
						.. sultanatetflag_P .. coaflag_P .. footballflag_P .. olfootballflag_P
			ColHeaderx_P = ColHeaderCoa_P .. ColHeaderShield_P .. ColHeaderSeal_P .. HistColHeaderx_P .. ColHeadera_P .. ColHeaderb_P .. ColHeaderc_P .. OLColHeaderx_P .. ColHeaderNaval_P ..
						ColHeaderAirforce_P .. ColHeaderCoastguard_P .. ColHeaderSultanatet_P .. ColHeaderCoa_P ..
						ColHeaderFootball_P .. ColHeaderOLFootball_P
			TableHeader_P = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_P .. '\n!' .. ColHeader1_P .. '\n!' .. ColHeader2_P .. '\n!' .. ColHeader3_P .. ColHeaderx_P .. '\n' ..
[=[|-
]=]
			TableBottom_P = '|}\n'
			row_P = Col0_P .. Col1_P .. Col2_P .. Col3_P .. ColYear_P .. ColEnd_P
			rows_P = rows_P .. row_P
			Table_P = TableHeader_P .. row_P .. TableBottom_P
			Tables_P = Tables_P .. Table_P
	end
	
	local Tables_Q = ''
    local rows_Q = ''
    local Areas_Q = 0
	for area_Q in mw.ustring.gmatch( text, '%[%"Q%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_Q = string.sub(area_Q,3,-8)
    		
    		Areas_Q = Areas_Q+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_Q
			local flagdata_Q = require("Modul:Flagg/Masterdata").flagdata[area_Q]
			local PageLink_Q = flagdata_Q.pagelink
			local Name_Q = flagdata_Q.name
			local DefFlag_Q = flagdata_Q.defflag
			if PageLink_Q == nil then lenke_Q = '[[' .. Name_Q .. ']]' else lenke_Q = '[[' .. PageLink_Q .. '|' .. Name_Q .. ']]' end
			Col0_Q = '|' .. Areas_Q .. '\n'
			Col1_Q = '|' .. lenke_Q .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_Q .. '|dok]])</small>\n'
			Col2_Q = '|<code>' .. area_Q .. '</code>\n'
			Col3_Q = '|align="center"|[[Fil:' .. DefFlag_Q .. '|33x27px]]'
			ColHeader0_Q = '#'
			ColHeader1_Q = 'Land'
			ColHeader2_Q = 'Argument 1'
			ColHeader3_Q = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_Q = ''
				local HistColHeaderx_Q = ''
				local i_Q = 1
 				repeat
					if flagdata_Q['histyear'..i_Q] then
						Histyearx_Q = flagdata_Q['histyear'..i_Q]
						Histflagx_Q = flagdata_Q['histflag'..i_Q]
						if i_Q > 1 then
							Histyearfrom_Q = flagdata_Q['histyear'..i_Q-1]+1 .. '–'
							Histyearto_Q = Histyearx_Q
						else
							Histyearfrom_Q = "<="
							Histyearto_Q = Histyearx_Q
						end
						HistColHeaderx_Q = HistColHeaderx_Q .. '\n!' .. Histyearfrom_Q .. Histyearx_Q
					else
						break
					end
					Histyears_Q = Histyears_Q .. '\n|align="center"|[[Fil:' .. Histflagx_Q .. '|33x27px]]'
					i_Q=i_Q+1
				until not flagdata_Q['histyear' .. i_Q]
				
			 	-- Henter ut olympiske flagg
				local OLyears_Q = ''
				local OLColHeaderx_Q = ''
				local j_Q = 1
 				repeat
					if flagdata_Q['OLyear'..j_Q] then
						OLyearx_Q = flagdata_Q['OLyear'..j_Q]
						OLflagx_Q = flagdata_Q['OLflag'..j_Q]
						OLColHeaderx_Q = OLColHeaderx_Q .. '\n!' .. OLyearx_Q
					else
						break
					end
					OLyears_Q = OLyears_Q .. '\n|align="center"|[[Fil:' .. OLflagx_Q .. '|33x27px]]'
					j_Q=j_Q+1
				until not flagdata_Q['OLyear' .. j_Q]
				if flagdata_Q['histyeara'] then
					histyeara_Q = flagdata_Q['histyeara']
					histflaga_Q = flagdata_Q['histflaga']
					ColHeadera_Q = '\n!' .. histyeara_Q
					yearsa_Q = '\n|align="center"|[[Fil:' .. histflaga_Q .. '|33x27px]]'
				else
					yearsa_Q = ""
					ColHeadera_Q = ""
				end
				if flagdata_Q['histyearb'] then
					histyearb_Q = flagdata_Q['histyearb']
					histflagb_Q = flagdata_Q['histflagb']
					ColHeaderb_Q = '\n!' .. histyearb_Q
					yearsb_Q = '\n|align="center"|[[Fil:' .. histflagb_Q .. '|33x27px]]'
				else
					yearsb_Q = ""
					ColHeaderb_Q = ""
				end
				if flagdata_Q['histyearc'] then
					histyearc_Q = flagdata_Q['histyearc']
					histflagc_Q = flagdata_Q['histflagc']
					ColHeaderc_Q = '\n!' .. histyearc_Q
					yearsc_Q = '\n|align="center"|[[Fil:' .. histflagc_Q .. '|33x27px]]'
				else
					yearsc_Q = ""
					ColHeaderc_Q = ""
				end
				if flagdata_Q['naval'] then
					naval_Q = flagdata_Q['naval']
					ColHeaderNaval_Q = '\n!naval'
					navalflag_Q = '\n|align="center"|[[Fil:' .. naval_Q .. '|33x27px]]'
				else
					navalflag_Q = ""
					ColHeaderNaval_Q = ""
				end
				if flagdata_Q['airforce'] then
					airforce_Q = flagdata_Q['airforce']
					ColHeaderAirforce_Q = '\n!airforce'
					airforceflag_Q = '\n|align="center"|[[Fil:' .. airforce_Q .. '|33x27px]]'
				else
					airforceflag_Q = ""
					ColHeaderAirforce_Q = ""
				end
				if flagdata_Q['coastguard'] then
					coastguard_Q = flagdata_Q['coastguard']
					ColHeaderCoastguard_Q = '\n!coastguard'
					coastguardflag_Q = '\n|align="center"|[[Fil:' .. coastguard_Q .. '|33x27px]]'
				else
					coastguardflag_Q = ""
					ColHeaderCoastguard_Q = ""
				end
				if flagdata_Q['sultanatet'] then
					sultanatet_Q = flagdata_Q['sultanatet']
					ColHeaderSultanatet_Q = '\n!sultanatet'
					sultanatetflag_Q = '\n|align="center"|[[Fil:' .. sultanatet_Q .. '|33x27px]]'
				else
					sultanatetflag_Q = ""
					ColHeaderSultanatet_Q = ""
				end
				if flagdata_Q['coa'] then
					coa_Q = flagdata_Q['coa']
					ColHeaderCoa_Q = '\n!våpen'
					coaflag_Q = '\n|align="center"|[[Fil:' .. coa_Q .. '|33x27px]]'
				else
					coaflag_Q = ""
					ColHeaderCoa_Q = ""
				end
				if flagdata_Q['shield'] then
					shield_Q = flagdata_Q['shield']
					ColHeaderShield_Q = '\n!skjold'
					shieldflag_Q = '\n|align="center"|[[Fil:' .. shield_Q .. '|33x27px]]'
				else
					shieldflag_Q = ""
					ColHeaderShield_Q = ""
				end
				if flagdata_Q['seal'] then
					seal_Q = flagdata_Q['seal']
					ColHeaderSeal_Q = '\n!segl'
					sealflag_Q = '\n|align="center"|[[Fil:' .. seal_Q .. '|33x27px]]'
				else
					sealflag_Q = ""
					ColHeaderSeal_Q = ""
				end
				if flagdata_Q['football'] then
					football_Q = flagdata_Q['football']
					ColHeaderFootball_Q = '\n!fotball'
					footballflag_Q = '\n|align="center"|[[Fil:' .. football_Q .. '|33x27px]]'
				else
					footballflag_Q = ""
					ColHeaderFootball_Q = ""
				end
				if flagdata_Q['OLfootball'] then
					olfootball_Q = flagdata_Q['OLfootball']
					ColHeaderOLFootball_Q = '\n!OL (fotball)'
					olfootballflag_Q = '\n|align="center"|[[Fil:' .. olfootball_Q .. '|33x27px]]'
				else
					olfootballflag_Q = ""
					ColHeaderOLFootball_Q = ""
				end
			ColEnd_Q = '\n|-\n'
			ColYear_Q = coaflag_Q .. shieldflag_Q .. sealflag_Q .. Histyears_Q .. OLyears_Q .. yearsa_Q .. yearsb_Q .. yearsc_Q .. navalflag_Q .. airforceflag_Q .. coastguardflag_Q
						.. sultanatetflag_Q .. coaflag_Q .. footballflag_Q .. olfootballflag_Q
			ColHeaderx_Q = ColHeaderCoa_Q .. ColHeaderShield_Q .. ColHeaderSeal_Q .. HistColHeaderx_Q .. ColHeadera_Q .. ColHeaderb_Q .. ColHeaderc_Q .. OLColHeaderx_Q .. ColHeaderNaval_Q ..
						ColHeaderAirforce_Q .. ColHeaderCoastguard_Q .. ColHeaderSultanatet_Q .. ColHeaderCoa_Q ..
						ColHeaderFootball_Q .. ColHeaderOLFootball_Q
			TableHeader_Q = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_Q .. '\n!' .. ColHeader1_Q .. '\n!' .. ColHeader2_Q .. '\n!' .. ColHeader3_Q .. ColHeaderx_Q .. '\n' ..
[=[|-
]=]
			TableBottom_Q = '|}\n'
			row_Q = Col0_Q .. Col1_Q .. Col2_Q .. Col3_Q .. ColYear_Q .. ColEnd_Q
			rows_Q = rows_Q .. row_Q
			Table_Q = TableHeader_Q .. row_Q .. TableBottom_Q
			Tables_Q = Tables_Q .. Table_Q
	end
	
	local Tables_R = ''
    local rows_R = ''
    local Areas_R = 0
	for area_R in mw.ustring.gmatch( text, '%[%"R%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_R = string.sub(area_R,3,-8)
    		
    		Areas_R = Areas_R+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_R
			local flagdata_R = require("Modul:Flagg/Masterdata").flagdata[area_R]
			local PageLink_R = flagdata_R.pagelink
			local Name_R = flagdata_R.name
			local DefFlag_R = flagdata_R.defflag
			if PageLink_R == nil then lenke_R = '[[' .. Name_R .. ']]' else lenke_R = '[[' .. PageLink_R .. '|' .. Name_R .. ']]' end
			Col0_R = '|' .. Areas_R .. '\n'
			Col1_R = '|' .. lenke_R .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_R .. '|dok]])</small>\n'
			Col2_R = '|<code>' .. area_R .. '</code>\n'
			Col3_R = '|align="center"|[[Fil:' .. DefFlag_R .. '|33x27px]]'
			ColHeader0_R = '#'
			ColHeader1_R = 'Land'
			ColHeader2_R = 'Argument 1'
			ColHeader3_R = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_R = ''
				local HistColHeaderx_R = ''
				local i_R = 1
 				repeat
					if flagdata_R['histyear'..i_R] then
						Histyearx_R = flagdata_R['histyear'..i_R]
						Histflagx_R = flagdata_R['histflag'..i_R]
						if i_R > 1 then
							Histyearfrom_R = flagdata_R['histyear'..i_R-1]+1 .. '–'
							Histyearto_R = Histyearx_R
						else
							Histyearfrom_R = "<="
							Histyearto_R = Histyearx_R
						end
						HistColHeaderx_R = HistColHeaderx_R .. '\n!' .. Histyearfrom_R .. Histyearx_R
					else
						break
					end
					Histyears_R = Histyears_R .. '\n|align="center"|[[Fil:' .. Histflagx_R .. '|33x27px]]'
					i_R=i_R+1
				until not flagdata_R['histyear' .. i_R]
				
			 	-- Henter ut olympiske flagg
				local OLyears_R = ''
				local OLColHeaderx_R = ''
				local j_R = 1
 				repeat
					if flagdata_R['OLyear'..j_R] then
						OLyearx_R = flagdata_R['OLyear'..j_R]
						OLflagx_R = flagdata_R['OLflag'..j_R]
						OLColHeaderx_R = OLColHeaderx_R .. '\n!' .. OLyearx_R
					else
						break
					end
					OLyears_R = OLyears_R .. '\n|align="center"|[[Fil:' .. OLflagx_R .. '|33x27px]]'
					j_R=j_R+1
				until not flagdata_R['OLyear' .. j_R]
				if flagdata_R['histyeara'] then
					histyeara_R = flagdata_R['histyeara']
					histflaga_R = flagdata_R['histflaga']
					ColHeadera_R = '\n!' .. histyeara_R
					yearsa_R = '\n|align="center"|[[Fil:' .. histflaga_R .. '|33x27px]]'
				else
					yearsa_R = ""
					ColHeadera_R = ""
				end
				if flagdata_R['histyearb'] then
					histyearb_R = flagdata_R['histyearb']
					histflagb_R = flagdata_R['histflagb']
					ColHeaderb_R = '\n!' .. histyearb_R
					yearsb_R = '\n|align="center"|[[Fil:' .. histflagb_R .. '|33x27px]]'
				else
					yearsb_R = ""
					ColHeaderb_R = ""
				end
				if flagdata_R['histyearc'] then
					histyearc_R = flagdata_R['histyearc']
					histflagc_R = flagdata_R['histflagc']
					ColHeaderc_R = '\n!' .. histyearc_R
					yearsc_R = '\n|align="center"|[[Fil:' .. histflagc_R .. '|33x27px]]'
				else
					yearsc_R = ""
					ColHeaderc_R = ""
				end
				if flagdata_R['naval'] then
					naval_R = flagdata_R['naval']
					ColHeaderNaval_R = '\n!naval'
					navalflag_R = '\n|align="center"|[[Fil:' .. naval_R .. '|33x27px]]'
				else
					navalflag_R = ""
					ColHeaderNaval_R = ""
				end
				if flagdata_R['airforce'] then
					airforce_R = flagdata_R['airforce']
					ColHeaderAirforce_R = '\n!airforce'
					airforceflag_R = '\n|align="center"|[[Fil:' .. airforce_R .. '|33x27px]]'
				else
					airforceflag_R = ""
					ColHeaderAirforce_R = ""
				end
				if flagdata_R['coastguard'] then
					coastguard_R = flagdata_R['coastguard']
					ColHeaderCoastguard_R = '\n!coastguard'
					coastguardflag_R = '\n|align="center"|[[Fil:' .. coastguard_R .. '|33x27px]]'
				else
					coastguardflag_R = ""
					ColHeaderCoastguard_R = ""
				end
				if flagdata_R['sultanatet'] then
					sultanatet_R = flagdata_R['sultanatet']
					ColHeaderSultanatet_R = '\n!sultanatet'
					sultanatetflag_R = '\n|align="center"|[[Fil:' .. sultanatet_R .. '|33x27px]]'
				else
					sultanatetflag_R = ""
					ColHeaderSultanatet_R = ""
				end
				if flagdata_R['coa'] then
					coa_R = flagdata_R['coa']
					ColHeaderCoa_R = '\n!våpen'
					coaflag_R = '\n|align="center"|[[Fil:' .. coa_R .. '|33x27px]]'
				else
					coaflag_R = ""
					ColHeaderCoa_R = ""
				end
				if flagdata_R['shield'] then
					shield_R = flagdata_R['shield']
					ColHeaderShield_R = '\n!skjold'
					shieldflag_R = '\n|align="center"|[[Fil:' .. shield_R .. '|33x27px]]'
				else
					shieldflag_R = ""
					ColHeaderShield_R = ""
				end
				if flagdata_R['seal'] then
					seal_R = flagdata_R['seal']
					ColHeaderSeal_R = '\n!segl'
					sealflag_R = '\n|align="center"|[[Fil:' .. seal_R .. '|33x27px]]'
				else
					sealflag_R = ""
					ColHeaderSeal_R = ""
				end
				if flagdata_R['football'] then
					football_R = flagdata_R['football']
					ColHeaderFootball_R = '\n!fotball'
					footballflag_R = '\n|align="center"|[[Fil:' .. football_R .. '|33x27px]]'
				else
					footballflag_R = ""
					ColHeaderFootball_R = ""
				end
				if flagdata_R['OLfootball'] then
					olfootball_R = flagdata_R['OLfootball']
					ColHeaderOLFootball_R = '\n!OL (fotball)'
					olfootballflag_R = '\n|align="center"|[[Fil:' .. olfootball_R .. '|33x27px]]'
				else
					olfootballflag_R = ""
					ColHeaderOLFootball_R = ""
				end
			ColEnd_R = '\n|-\n'
			ColYear_R = coaflag_R .. shieldflag_R .. sealflag_R .. Histyears_R .. OLyears_R .. yearsa_R .. yearsb_R .. yearsc_R .. navalflag_R .. airforceflag_R .. coastguardflag_R
						.. sultanatetflag_R .. coaflag_R .. footballflag_R .. olfootballflag_R
			ColHeaderx_R = ColHeaderCoa_R .. ColHeaderShield_R .. ColHeaderSeal_R .. HistColHeaderx_R .. ColHeadera_R .. ColHeaderb_R .. ColHeaderc_R .. OLColHeaderx_R .. ColHeaderNaval_R ..
						ColHeaderAirforce_R .. ColHeaderCoastguard_R .. ColHeaderSultanatet_R .. ColHeaderCoa_R ..
						ColHeaderFootball_R .. ColHeaderOLFootball_R
			TableHeader_R = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_R .. '\n!' .. ColHeader1_R .. '\n!' .. ColHeader2_R .. '\n!' .. ColHeader3_R .. ColHeaderx_R .. '\n' ..
[=[|-
]=]
			TableBottom_R = '|}\n'
			row_R = Col0_R .. Col1_R .. Col2_R .. Col3_R .. ColYear_R .. ColEnd_R
			rows_R = rows_R .. row_R
			Table_R = TableHeader_R .. row_R .. TableBottom_R
			Tables_R = Tables_R .. Table_R
	end
	
	local Tables_S = ''
    local rows_S = ''
    local Areas_S = 0
	for area_S in mw.ustring.gmatch( text, '%[%"S%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_S = string.sub(area_S,3,-8)
    		
    		Areas_S = Areas_S+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_S
			local flagdata_S = require("Modul:Flagg/Masterdata").flagdata[area_S]
			local PageLink_S = flagdata_S.pagelink
			local Name_S = flagdata_S.name
			local DefFlag_S = flagdata_S.defflag
			if PageLink_S == nil then lenke_S = '[[' .. Name_S .. ']]' else lenke_S = '[[' .. PageLink_S .. '|' .. Name_S .. ']]' end
			Col0_S = '|' .. Areas_S .. '\n'
			Col1_S = '|' .. lenke_S .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_S .. '|dok]])</small>\n'
			Col2_S = '|<code>' .. area_S .. '</code>\n'
			Col3_S = '|align="center"|[[Fil:' .. DefFlag_S .. '|33x27px]]'
			ColHeader0_S = '#'
			ColHeader1_S = 'Land'
			ColHeader2_S = 'Argument 1'
			ColHeader3_S = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_S = ''
				local HistColHeaderx_S = ''
				local i_S = 1
 				repeat
					if flagdata_S['histyear'..i_S] then
						Histyearx_S = flagdata_S['histyear'..i_S]
						Histflagx_S = flagdata_S['histflag'..i_S]
						if i_S > 1 then
							Histyearfrom_S = flagdata_S['histyear'..i_S-1]+1 .. '–'
							Histyearto_S = Histyearx_S
						else
							Histyearfrom_S = "<="
							Histyearto_S = Histyearx_S
						end
						HistColHeaderx_S = HistColHeaderx_S .. '\n!' .. Histyearfrom_S .. Histyearx_S
					else
						break
					end
					Histyears_S = Histyears_S .. '\n|align="center"|[[Fil:' .. Histflagx_S .. '|33x27px]]'
					i_S=i_S+1
				until not flagdata_S['histyear' .. i_S]
				
			 	-- Henter ut olympiske flagg
				local OLyears_S = ''
				local OLColHeaderx_S = ''
				local j_S = 1
 				repeat
					if flagdata_S['OLyear'..j_S] then
						OLyearx_S = flagdata_S['OLyear'..j_S]
						OLflagx_S = flagdata_S['OLflag'..j_S]
						OLColHeaderx_S = OLColHeaderx_S .. '\n!' .. OLyearx_S
					else
						break
					end
					OLyears_S = OLyears_S .. '\n|align="center"|[[Fil:' .. OLflagx_S .. '|33x27px]]'
					j_S=j_S+1
				until not flagdata_S['OLyear' .. j_S]
				if flagdata_S['histyeara'] then
					histyeara_S = flagdata_S['histyeara']
					histflaga_S = flagdata_S['histflaga']
					ColHeadera_S = '\n!' .. histyeara_S
					yearsa_S = '\n|align="center"|[[Fil:' .. histflaga_S .. '|33x27px]]'
				else
					yearsa_S = ""
					ColHeadera_S = ""
				end
				if flagdata_S['histyearb'] then
					histyearb_S = flagdata_S['histyearb']
					histflagb_S = flagdata_S['histflagb']
					ColHeaderb_S = '\n!' .. histyearb_S
					yearsb_S = '\n|align="center"|[[Fil:' .. histflagb_S .. '|33x27px]]'
				else
					yearsb_S = ""
					ColHeaderb_S = ""
				end
				if flagdata_S['histyearc'] then
					histyearc_S = flagdata_S['histyearc']
					histflagc_S = flagdata_S['histflagc']
					ColHeaderc_S = '\n!' .. histyearc_S
					yearsc_S = '\n|align="center"|[[Fil:' .. histflagc_S .. '|33x27px]]'
				else
					yearsc_S = ""
					ColHeaderc_S = ""
				end
				if flagdata_S['naval'] then
					naval_S = flagdata_S['naval']
					ColHeaderNaval_S = '\n!naval'
					navalflag_S = '\n|align="center"|[[Fil:' .. naval_S .. '|33x27px]]'
				else
					navalflag_S = ""
					ColHeaderNaval_S = ""
				end
				if flagdata_S['airforce'] then
					airforce_S = flagdata_S['airforce']
					ColHeaderAirforce_S = '\n!airforce'
					airforceflag_S = '\n|align="center"|[[Fil:' .. airforce_S .. '|33x27px]]'
				else
					airforceflag_S = ""
					ColHeaderAirforce_S = ""
				end
				if flagdata_S['coastguard'] then
					coastguard_S = flagdata_S['coastguard']
					ColHeaderCoastguard_S = '\n!coastguard'
					coastguardflag_S = '\n|align="center"|[[Fil:' .. coastguard_S .. '|33x27px]]'
				else
					coastguardflag_S = ""
					ColHeaderCoastguard_S = ""
				end
				if flagdata_S['sultanatet'] then
					sultanatet_S = flagdata_S['sultanatet']
					ColHeaderSultanatet_S = '\n!sultanatet'
					sultanatetflag_S = '\n|align="center"|[[Fil:' .. sultanatet_S .. '|33x27px]]'
				else
					sultanatetflag_S = ""
					ColHeaderSultanatet_S = ""
				end
				if flagdata_S['coa'] then
					coa_S = flagdata_S['coa']
					ColHeaderCoa_S = '\n!våpen'
					coaflag_S = '\n|align="center"|[[Fil:' .. coa_S .. '|33x27px]]'
				else
					coaflag_S = ""
					ColHeaderCoa_S = ""
				end
				if flagdata_S['shield'] then
					shield_S = flagdata_S['shield']
					ColHeaderShield_S = '\n!skjold'
					shieldflag_S = '\n|align="center"|[[Fil:' .. shield_S .. '|33x27px]]'
				else
					shieldflag_S = ""
					ColHeaderShield_S = ""
				end
				if flagdata_S['seal'] then
					seal_S = flagdata_S['seal']
					ColHeaderSeal_S = '\n!segl'
					sealflag_S = '\n|align="center"|[[Fil:' .. seal_S .. '|33x27px]]'
				else
					sealflag_S = ""
					ColHeaderSeal_S = ""
				end
				if flagdata_S['football'] then
					football_S = flagdata_S['football']
					ColHeaderFootball_S = '\n!fotball'
					footballflag_S = '\n|align="center"|[[Fil:' .. football_S .. '|33x27px]]'
				else
					footballflag_S = ""
					ColHeaderFootball_S = ""
				end
				if flagdata_S['OLfootball'] then
					olfootball_S = flagdata_S['OLfootball']
					ColHeaderOLFootball_S = '\n!OL (fotball)'
					olfootballflag_S = '\n|align="center"|[[Fil:' .. olfootball_S .. '|33x27px]]'
				else
					olfootballflag_S = ""
					ColHeaderOLFootball_S = ""
				end
			ColEnd_S = '\n|-\n'
			ColYear_S = coaflag_S .. shieldflag_S .. sealflag_S .. Histyears_S .. OLyears_S .. yearsa_S .. yearsb_S .. yearsc_S .. navalflag_S .. airforceflag_S .. coastguardflag_S
						.. sultanatetflag_S .. coaflag_S .. footballflag_S .. olfootballflag_S
			ColHeaderx_S = ColHeaderCoa_S .. ColHeaderShield_S .. ColHeaderSeal_S .. HistColHeaderx_S .. ColHeadera_S .. ColHeaderb_S .. ColHeaderc_S .. OLColHeaderx_S .. ColHeaderNaval_S ..
						ColHeaderAirforce_S .. ColHeaderCoastguard_S .. ColHeaderSultanatet_S .. ColHeaderCoa_S ..
						ColHeaderFootball_S .. ColHeaderOLFootball_S
			TableHeader_S = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_S .. '\n!' .. ColHeader1_S .. '\n!' .. ColHeader2_S .. '\n!' .. ColHeader3_S .. ColHeaderx_S .. '\n' ..
[=[|-
]=]
			TableBottom_S = '|}\n'
			row_S = Col0_S .. Col1_S .. Col2_S .. Col3_S .. ColYear_S .. ColEnd_S
			rows_S = rows_S .. row_S
			Table_S = TableHeader_S .. row_S .. TableBottom_S
			Tables_S = Tables_S .. Table_S
	end
	
	local Tables_T = ''
    local rows_T = ''
    local Areas_T = 0
	for area_T in mw.ustring.gmatch( text, '%[%"T%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_T = string.sub(area_T,3,-8)
    		
    		Areas_T = Areas_T+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_T
			local flagdata_T = require("Modul:Flagg/Masterdata").flagdata[area_T]
			local PageLink_T = flagdata_T.pagelink
			local Name_T = flagdata_T.name
			local DefFlag_T = flagdata_T.defflag
			if PageLink_T == nil then lenke_T = '[[' .. Name_T .. ']]' else lenke_T = '[[' .. PageLink_T .. '|' .. Name_T .. ']]' end
			Col0_T = '|' .. Areas_T .. '\n'
			Col1_T = '|' .. lenke_T .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_T .. '|dok]])</small>\n'
			Col2_T = '|<code>' .. area_T .. '</code>\n'
			Col3_T = '|align="center"|[[Fil:' .. DefFlag_T .. '|33x27px]]'
			ColHeader0_T = '#'
			ColHeader1_T = 'Land'
			ColHeader2_T = 'Argument 1'
			ColHeader3_T = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_T = ''
				local HistColHeaderx_T = ''
				local i_T = 1
 				repeat
					if flagdata_T['histyear'..i_T] then
						Histyearx_T = flagdata_T['histyear'..i_T]
						Histflagx_T = flagdata_T['histflag'..i_T]
						if i_T > 1 then
							Histyearfrom_T = flagdata_T['histyear'..i_T-1]+1 .. '–'
							Histyearto_T = Histyearx_T
						else
							Histyearfrom_T = "<="
							Histyearto_T = Histyearx_T
						end
						HistColHeaderx_T = HistColHeaderx_T .. '\n!' .. Histyearfrom_T .. Histyearx_T
					else
						break
					end
					Histyears_T = Histyears_T .. '\n|align="center"|[[Fil:' .. Histflagx_T .. '|33x27px]]'
					i_T=i_T+1
				until not flagdata_T['histyear' .. i_T]
				
			 	-- Henter ut olympiske flagg
				local OLyears_T = ''
				local OLColHeaderx_T = ''
				local j_T = 1
 				repeat
					if flagdata_T['OLyear'..j_T] then
						OLyearx_T = flagdata_T['OLyear'..j_T]
						OLflagx_T = flagdata_T['OLflag'..j_T]
						OLColHeaderx_T = OLColHeaderx_T .. '\n!' .. OLyearx_T
					else
						break
					end
					OLyears_T = OLyears_T .. '\n|align="center"|[[Fil:' .. OLflagx_T .. '|33x27px]]'
					j_T=j_T+1
				until not flagdata_T['OLyear' .. j_T]
				if flagdata_T['histyeara'] then
					histyeara_T = flagdata_T['histyeara']
					histflaga_T = flagdata_T['histflaga']
					ColHeadera_T = '\n!' .. histyeara_T
					yearsa_T = '\n|align="center"|[[Fil:' .. histflaga_T .. '|33x27px]]'
				else
					yearsa_T = ""
					ColHeadera_T = ""
				end
				if flagdata_T['histyearb'] then
					histyearb_T = flagdata_T['histyearb']
					histflagb_T = flagdata_T['histflagb']
					ColHeaderb_T = '\n!' .. histyearb_T
					yearsb_T = '\n|align="center"|[[Fil:' .. histflagb_T .. '|33x27px]]'
				else
					yearsb_T = ""
					ColHeaderb_T = ""
				end
				if flagdata_T['histyearc'] then
					histyearc_T = flagdata_T['histyearc']
					histflagc_T = flagdata_T['histflagc']
					ColHeaderc_T = '\n!' .. histyearc_T
					yearsc_T = '\n|align="center"|[[Fil:' .. histflagc_T .. '|33x27px]]'
				else
					yearsc_T = ""
					ColHeaderc_T = ""
				end
				if flagdata_T['naval'] then
					naval_T = flagdata_T['naval']
					ColHeaderNaval_T = '\n!naval'
					navalflag_T = '\n|align="center"|[[Fil:' .. naval_T .. '|33x27px]]'
				else
					navalflag_T = ""
					ColHeaderNaval_T = ""
				end
				if flagdata_T['airforce'] then
					airforce_T = flagdata_T['airforce']
					ColHeaderAirforce_T = '\n!airforce'
					airforceflag_T = '\n|align="center"|[[Fil:' .. airforce_T .. '|33x27px]]'
				else
					airforceflag_T = ""
					ColHeaderAirforce_T = ""
				end
				if flagdata_T['coastguard'] then
					coastguard_T = flagdata_T['coastguard']
					ColHeaderCoastguard_T = '\n!coastguard'
					coastguardflag_T = '\n|align="center"|[[Fil:' .. coastguard_T .. '|33x27px]]'
				else
					coastguardflag_T = ""
					ColHeaderCoastguard_T = ""
				end
				if flagdata_T['sultanatet'] then
					sultanatet_T = flagdata_T['sultanatet']
					ColHeaderSultanatet_T = '\n!sultanatet'
					sultanatetflag_T = '\n|align="center"|[[Fil:' .. sultanatet_T .. '|33x27px]]'
				else
					sultanatetflag_T = ""
					ColHeaderSultanatet_T = ""
				end
				if flagdata_T['coa'] then
					coa_T = flagdata_T['coa']
					ColHeaderCoa_T = '\n!våpen'
					coaflag_T = '\n|align="center"|[[Fil:' .. coa_T .. '|33x27px]]'
				else
					coaflag_T = ""
					ColHeaderCoa_T = ""
				end
				if flagdata_T['football'] then
					football_T = flagdata_T['football']
					ColHeaderFootball_T = '\n!fotball'
					footballflag_T = '\n|align="center"|[[Fil:' .. football_T .. '|33x27px]]'
				else
					footballflag_T = ""
					ColHeaderFootball_T = ""
				end
				if flagdata_T['shield'] then
					shield_T = flagdata_T['shield']
					ColHeaderShield_T = '\n!skjold'
					shieldflag_T = '\n|align="center"|[[Fil:' .. shield_T .. '|33x27px]]'
				else
					shieldflag_T = ""
					ColHeaderShield_T = ""
				end
				if flagdata_T['seal'] then
					seal_T = flagdata_T['seal']
					ColHeaderSeal_T = '\n!segl'
					sealflag_T = '\n|align="center"|[[Fil:' .. seal_T .. '|33x27px]]'
				else
					sealflag_T = ""
					ColHeaderSeal_T = ""
				end
				if flagdata_T['OLfootball'] then
					olfootball_T = flagdata_T['OLfootball']
					ColHeaderOLFootball_T = '\n!OL (fotball)'
					olfootballflag_T = '\n|align="center"|[[Fil:' .. olfootball_T .. '|33x27px]]'
				else
					olfootballflag_T = ""
					ColHeaderOLFootball_T = ""
				end
			ColEnd_T = '\n|-\n'
			ColYear_T = coaflag_T .. shieldflag_T .. sealflag_T .. Histyears_T .. OLyears_T .. yearsa_T .. yearsb_T .. yearsc_T .. navalflag_T .. airforceflag_T .. coastguardflag_T
						.. sultanatetflag_T .. coaflag_T .. footballflag_T .. olfootballflag_T
			ColHeaderx_T = ColHeaderCoa_T .. ColHeaderShield_T .. ColHeaderSeal_T .. HistColHeaderx_T .. ColHeadera_T .. ColHeaderb_T .. ColHeaderc_T .. OLColHeaderx_T .. ColHeaderNaval_T ..
						ColHeaderAirforce_T .. ColHeaderCoastguard_T .. ColHeaderSultanatet_T .. ColHeaderCoa_T ..
						ColHeaderFootball_T .. ColHeaderOLFootball_T
			TableHeader_T = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_T .. '\n!' .. ColHeader1_T .. '\n!' .. ColHeader2_T .. '\n!' .. ColHeader3_T .. ColHeaderx_T .. '\n' ..
[=[|-
]=]
			TableBottom_T = '|}\n'
			row_T = Col0_T .. Col1_T .. Col2_T .. Col3_T .. ColYear_T .. ColEnd_T
			rows_T = rows_T .. row_T
			Table_T = TableHeader_T .. row_T .. TableBottom_T
			Tables_T = Tables_T .. Table_T
	end
	
	local Tables_U = ''
    local rows_U = ''
    local Areas_U = 0
	for area_U in mw.ustring.gmatch( text, '%[%"U%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_U = string.sub(area_U,3,-8)
    		
    		Areas_U = Areas_U+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_U
			local flagdata_U = require("Modul:Flagg/Masterdata").flagdata[area_U]
			local PageLink_U = flagdata_U.pagelink
			local Name_U = flagdata_U.name
			local DefFlag_U = flagdata_U.defflag
			if PageLink_U == nil then lenke_U = '[[' .. Name_U .. ']]' else lenke_U = '[[' .. PageLink_U .. '|' .. Name_U .. ']]' end
			Col0_U = '|' .. Areas_U .. '\n'
			Col1_U = '|' .. lenke_U .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_U .. '|dok]])</small>\n'
			Col2_U = '|<code>' .. area_U .. '</code>\n'
			Col3_U = '|align="center"|[[Fil:' .. DefFlag_U .. '|33x27px]]'
			ColHeader0_U = '#'
			ColHeader1_U = 'Land'
			ColHeader2_U = 'Argument 1'
			ColHeader3_U = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_U = ''
				local HistColHeaderx_U = ''
				local i_U = 1
 				repeat
					if flagdata_U['histyear'..i_U] then
						Histyearx_U = flagdata_U['histyear'..i_U]
						Histflagx_U = flagdata_U['histflag'..i_U]
						if i_U > 1 then
							Histyearfrom_U = flagdata_U['histyear'..i_U-1]+1 .. '–'
							Histyearto_U = Histyearx_U
						else
							Histyearfrom_U = "<="
							Histyearto_U = Histyearx_U
						end
						HistColHeaderx_U = HistColHeaderx_U .. '\n!' .. Histyearfrom_U .. Histyearx_U
					else
						break
					end
					Histyears_U = Histyears_U .. '\n|align="center"|[[Fil:' .. Histflagx_U .. '|33x27px]]'
					i_U=i_U+1
				until not flagdata_U['histyear' .. i_U]
				
			 	-- Henter ut olympiske flagg
				local OLyears_U = ''
				local OLColHeaderx_U = ''
				local j_U = 1
 				repeat
					if flagdata_U['OLyear'..j_U] then
						OLyearx_U = flagdata_U['OLyear'..j_U]
						OLflagx_U = flagdata_U['OLflag'..j_U]
						OLColHeaderx_U = OLColHeaderx_U .. '\n!' .. OLyearx_U
					else
						break
					end
					OLyears_U = OLyears_U .. '\n|align="center"|[[Fil:' .. OLflagx_U .. '|33x27px]]'
					j_U=j_U+1
				until not flagdata_U['OLyear' .. j_U]
				if flagdata_U['histyeara'] then
					histyeara_U = flagdata_U['histyeara']
					histflaga_U = flagdata_U['histflaga']
					ColHeadera_U = '\n!' .. histyeara_U
					yearsa_U = '\n|align="center"|[[Fil:' .. histflaga_U .. '|33x27px]]'
				else
					yearsa_U = ""
					ColHeadera_U = ""
				end
				if flagdata_U['histyearb'] then
					histyearb_U = flagdata_U['histyearb']
					histflagb_U = flagdata_U['histflagb']
					ColHeaderb_U = '\n!' .. histyearb_U
					yearsb_U = '\n|align="center"|[[Fil:' .. histflagb_U .. '|33x27px]]'
				else
					yearsb_U = ""
					ColHeaderb_U = ""
				end
				if flagdata_U['histyearc'] then
					histyearc_U = flagdata_U['histyearc']
					histflagc_U = flagdata_U['histflagc']
					ColHeaderc_U = '\n!' .. histyearc_U
					yearsc_U = '\n|align="center"|[[Fil:' .. histflagc_U .. '|33x27px]]'
				else
					yearsc_U = ""
					ColHeaderc_U = ""
				end
				if flagdata_U['naval'] then
					naval_U = flagdata_U['naval']
					ColHeaderNaval_U = '\n!naval'
					navalflag_U = '\n|align="center"|[[Fil:' .. naval_U .. '|33x27px]]'
				else
					navalflag_U = ""
					ColHeaderNaval_U = ""
				end
				if flagdata_U['airforce'] then
					airforce_U = flagdata_U['airforce']
					ColHeaderAirforce_U = '\n!airforce'
					airforceflag_U = '\n|align="center"|[[Fil:' .. airforce_U .. '|33x27px]]'
				else
					airforceflag_U = ""
					ColHeaderAirforce_U = ""
				end
				if flagdata_U['coastguard'] then
					coastguard_U = flagdata_U['coastguard']
					ColHeaderCoastguard_U = '\n!coastguard'
					coastguardflag_U = '\n|align="center"|[[Fil:' .. coastguard_U .. '|33x27px]]'
				else
					coastguardflag_U = ""
					ColHeaderCoastguard_U = ""
				end
				if flagdata_U['sultanatet'] then
					sultanatet_U = flagdata_U['sultanatet']
					ColHeaderSultanatet_U = '\n!sultanatet'
					sultanatetflag_U = '\n|align="center"|[[Fil:' .. sultanatet_U .. '|33x27px]]'
				else
					sultanatetflag_U = ""
					ColHeaderSultanatet_U = ""
				end
				if flagdata_U['coa'] then
					coa_U = flagdata_U['coa']
					ColHeaderCoa_U = '\n!våpen'
					coaflag_U = '\n|align="center"|[[Fil:' .. coa_U .. '|33x27px]]'
				else
					coaflag_U = ""
					ColHeaderCoa_U = ""
				end
				if flagdata_U['shield'] then
					shield_U = flagdata_U['shield']
					ColHeaderShield_U = '\n!skjold'
					shieldflag_U = '\n|align="center"|[[Fil:' .. shield_U .. '|33x27px]]'
				else
					shieldflag_U = ""
					ColHeaderShield_U = ""
				end
				if flagdata_U['seal'] then
					seal_U = flagdata_U['seal']
					ColHeaderSeal_U = '\n!segl'
					sealflag_U = '\n|align="center"|[[Fil:' .. seal_U .. '|33x27px]]'
				else
					sealflag_U = ""
					ColHeaderSeal_U = ""
				end
				if flagdata_U['football'] then
					football_U = flagdata_U['football']
					ColHeaderFootball_U = '\n!fotball'
					footballflag_U = '\n|align="center"|[[Fil:' .. football_U .. '|33x27px]]'
				else
					footballflag_U = ""
					ColHeaderFootball_U = ""
				end
				if flagdata_U['OLfootball'] then
					olfootball_U = flagdata_U['OLfootball']
					ColHeaderOLFootball_U = '\n!OL (fotball)'
					olfootballflag_U = '\n|align="center"|[[Fil:' .. olfootball_U .. '|33x27px]]'
				else
					olfootballflag_U = ""
					ColHeaderOLFootball_U = ""
				end
			ColEnd_U = '\n|-\n'
			ColYear_U = coaflag_U .. shieldflag_U .. sealflag_U .. Histyears_U .. OLyears_U .. yearsa_U .. yearsb_U .. yearsc_U .. navalflag_U .. airforceflag_U .. coastguardflag_U
						.. sultanatetflag_U .. coaflag_U .. footballflag_U .. olfootballflag_U
			ColHeaderx_U = ColHeaderCoa_U .. ColHeaderShield_U .. ColHeaderSeal_U .. HistColHeaderx_U .. ColHeadera_U .. ColHeaderb_U .. ColHeaderc_U .. OLColHeaderx_U .. ColHeaderNaval_U ..
						ColHeaderAirforce_U .. ColHeaderCoastguard_U .. ColHeaderSultanatet_U .. ColHeaderCoa_U ..
						ColHeaderFootball_U .. ColHeaderOLFootball_U
			TableHeader_U = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_U .. '\n!' .. ColHeader1_U .. '\n!' .. ColHeader2_U .. '\n!' .. ColHeader3_U .. ColHeaderx_U .. '\n' ..
[=[|-
]=]
			TableBottom_U = '|}\n'
			row_U = Col0_U .. Col1_U .. Col2_U .. Col3_U .. ColYear_U .. ColEnd_U
			rows_U = rows_U .. row_U
			Table_U = TableHeader_U .. row_U .. TableBottom_U
			Tables_U = Tables_U .. Table_U
	end
	
	local Tables_V = ''
    local rows_V = ''
    local Areas_V = 0
	for area_V in mw.ustring.gmatch( text, '%[%"V%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_V = string.sub(area_V,3,-8)
    		
    		Areas_V = Areas_V+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_V
			local flagdata_V = require("Modul:Flagg/Masterdata").flagdata[area_V]
			local PageLink_V = flagdata_V.pagelink
			local Name_V = flagdata_V.name
			local DefFlag_V = flagdata_V.defflag
			if PageLink_V == nil then lenke_V = '[[' .. Name_V .. ']]' else lenke_V = '[[' .. PageLink_V .. '|' .. Name_V .. ']]' end
			Col0_V = '|' .. Areas_V .. '\n'
			Col1_V = '|' .. lenke_V .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_V .. '|dok]])</small>\n'
			Col2_V = '|<code>' .. area_V .. '</code>\n'
			Col3_V = '|align="center"|[[Fil:' .. DefFlag_V .. '|33x27px]]'
			ColHeader0_V = '#'
			ColHeader1_V = 'Land'
			ColHeader2_V = 'Argument 1'
			ColHeader3_V = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_V = ''
				local HistColHeaderx_V = ''
				local i_V = 1
 				repeat
					if flagdata_V['histyear'..i_V] then
						Histyearx_V = flagdata_V['histyear'..i_V]
						Histflagx_V = flagdata_V['histflag'..i_V]
						if i_V > 1 then
							Histyearfrom_V = flagdata_V['histyear'..i_V-1]+1 .. '–'
							Histyearto_V = Histyearx_V
						else
							Histyearfrom_V = "<="
							Histyearto_V = Histyearx_V
						end
						HistColHeaderx_V = HistColHeaderx_V .. '\n!' .. Histyearfrom_V .. Histyearx_V
					else
						break
					end
					Histyears_V = Histyears_V .. '\n|align="center"|[[Fil:' .. Histflagx_V .. '|33x27px]]'
					i_V=i_V+1
				until not flagdata_V['histyear' .. i_V]
				
			 	-- Henter ut olympiske flagg
				local OLyears_V = ''
				local OLColHeaderx_V = ''
				local j_V = 1
 				repeat
					if flagdata_V['OLyear'..j_V] then
						OLyearx_V = flagdata_V['OLyear'..j_V]
						OLflagx_V = flagdata_V['OLflag'..j_V]
						OLColHeaderx_V = OLColHeaderx_V .. '\n!' .. OLyearx_V
					else
						break
					end
					OLyears_V = OLyears_V .. '\n|align="center"|[[Fil:' .. OLflagx_V .. '|33x27px]]'
					j_V=j_V+1
				until not flagdata_V['OLyear' .. j_V]
				if flagdata_V['histyeara'] then
					histyeara_V = flagdata_V['histyeara']
					histflaga_V = flagdata_V['histflaga']
					ColHeadera_V = '\n!' .. histyeara_V
					yearsa_V = '\n|align="center"|[[Fil:' .. histflaga_V .. '|33x27px]]'
				else
					yearsa_V = ""
					ColHeadera_V = ""
				end
				if flagdata_V['histyearb'] then
					histyearb_V = flagdata_V['histyearb']
					histflagb_V = flagdata_V['histflagb']
					ColHeaderb_V = '\n!' .. histyearb_V
					yearsb_V = '\n|align="center"|[[Fil:' .. histflagb_V .. '|33x27px]]'
				else
					yearsb_V = ""
					ColHeaderb_V = ""
				end
				if flagdata_V['histyearc'] then
					histyearc_V = flagdata_V['histyearc']
					histflagc_V = flagdata_V['histflagc']
					ColHeaderc_V = '\n!' .. histyearc_V
					yearsc_V = '\n|align="center"|[[Fil:' .. histflagc_V .. '|33x27px]]'
				else
					yearsc_V = ""
					ColHeaderc_V = ""
				end
				if flagdata_V['naval'] then
					naval_V = flagdata_V['naval']
					ColHeaderNaval_V = '\n!naval'
					navalflag_V = '\n|align="center"|[[Fil:' .. naval_V .. '|33x27px]]'
				else
					navalflag_V = ""
					ColHeaderNaval_V = ""
				end
				if flagdata_V['airforce'] then
					airforce_V = flagdata_V['airforce']
					ColHeaderAirforce_V = '\n!airforce'
					airforceflag_V = '\n|align="center"|[[Fil:' .. airforce_V .. '|33x27px]]'
				else
					airforceflag_V = ""
					ColHeaderAirforce_V = ""
				end
				if flagdata_V['coastguard'] then
					coastguard_V = flagdata_V['coastguard']
					ColHeaderCoastguard_V = '\n!coastguard'
					coastguardflag_V = '\n|align="center"|[[Fil:' .. coastguard_V .. '|33x27px]]'
				else
					coastguardflag_V = ""
					ColHeaderCoastguard_V = ""
				end
				if flagdata_V['sultanatet'] then
					sultanatet_V = flagdata_V['sultanatet']
					ColHeaderSultanatet_V = '\n!sultanatet'
					sultanatetflag_V = '\n|align="center"|[[Fil:' .. sultanatet_V .. '|33x27px]]'
				else
					sultanatetflag_V = ""
					ColHeaderSultanatet_V = ""
				end
				if flagdata_V['coa'] then
					coa_V = flagdata_V['coa']
					ColHeaderCoa_V = '\n!våpen'
					coaflag_V = '\n|align="center"|[[Fil:' .. coa_V .. '|33x27px]]'
				else
					coaflag_V = ""
					ColHeaderCoa_V = ""
				end
				if flagdata_V['shield'] then
					shield_V = flagdata_V['shield']
					ColHeaderShield_V = '\n!skjold'
					shieldflag_V = '\n|align="center"|[[Fil:' .. shield_V .. '|33x27px]]'
				else
					shieldflag_V = ""
					ColHeaderShield_V = ""
				end
				if flagdata_V['seal'] then
					seal_V = flagdata_V['seal']
					ColHeaderSeal_V = '\n!segl'
					sealflag_V = '\n|align="center"|[[Fil:' .. seal_V .. '|33x27px]]'
				else
					sealflag_V = ""
					ColHeaderSeal_V = ""
				end
				if flagdata_V['football'] then
					football_V = flagdata_V['football']
					ColHeaderFootball_V = '\n!fotball'
					footballflag_V = '\n|align="center"|[[Fil:' .. football_V .. '|33x27px]]'
				else
					footballflag_V = ""
					ColHeaderFootball_V = ""
				end
				if flagdata_V['OLfootball'] then
					olfootball_V = flagdata_V['OLfootball']
					ColHeaderOLFootball_V = '\n!OL (fotball)'
					olfootballflag_V = '\n|align="center"|[[Fil:' .. olfootball_V .. '|33x27px]]'
				else
					olfootballflag_V = ""
					ColHeaderOLFootball_V = ""
				end
			ColEnd_V = '\n|-\n'
			ColYear_V = coaflag_V .. shieldflag_V .. sealflag_V .. Histyears_V .. OLyears_V .. yearsa_V .. yearsb_V .. yearsc_V .. navalflag_V .. airforceflag_V .. coastguardflag_V
						.. sultanatetflag_V .. coaflag_V .. footballflag_V .. olfootballflag_V
			ColHeaderx_V = ColHeaderCoa_V .. ColHeaderShield_V .. ColHeaderSeal_V .. HistColHeaderx_V .. ColHeadera_V .. ColHeaderb_V .. ColHeaderc_V .. OLColHeaderx_V .. ColHeaderNaval_V ..
						ColHeaderAirforce_V .. ColHeaderCoastguard_V .. ColHeaderSultanatet_V .. ColHeaderCoa_V ..
						ColHeaderFootball_V .. ColHeaderOLFootball_V
			TableHeader_V = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_V .. '\n!' .. ColHeader1_V .. '\n!' .. ColHeader2_V .. '\n!' .. ColHeader3_V .. ColHeaderx_V .. '\n' ..
[=[|-
]=]
			TableBottom_V = '|}\n'
			row_V = Col0_V .. Col1_V .. Col2_V .. Col3_V .. ColYear_V .. ColEnd_V
			rows_V = rows_V .. row_V
			Table_V = TableHeader_V .. row_V .. TableBottom_V
			Tables_V = Tables_V .. Table_V
	end
	
	local Tables_W = ''
    local rows_W = ''
    local Areas_W = 0
	for area_W in mw.ustring.gmatch( text, '%[%"W%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_W = string.sub(area_W,3,-8)
    		
    		Areas_W = Areas_W+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_W
			local flagdata_W = require("Modul:Flagg/Masterdata").flagdata[area_W]
			local PageLink_W = flagdata_W.pagelink
			local Name_W = flagdata_W.name
			local DefFlag_W = flagdata_W.defflag
			if PageLink_W == nil then lenke_W = '[[' .. Name_W .. ']]' else lenke_W = '[[' .. PageLink_W .. '|' .. Name_W .. ']]' end
			Col0_W = '|' .. Areas_W .. '\n'
			Col1_W = '|' .. lenke_W .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_W .. '|dok]])</small>\n'
			Col2_W = '|<code>' .. area_W .. '</code>\n'
			Col3_W = '|align="center"|[[Fil:' .. DefFlag_W .. '|33x27px]]'
			ColHeader0_W = '#'
			ColHeader1_W = 'Land'
			ColHeader2_W = 'Argument 1'
			ColHeader3_W = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_W = ''
				local HistColHeaderx_W = ''
				local i_W = 1
 				repeat
					if flagdata_W['histyear'..i_W] then
						Histyearx_W = flagdata_W['histyear'..i_W]
						Histflagx_W = flagdata_W['histflag'..i_W]
						if i_W > 1 then
							Histyearfrom_W = flagdata_W['histyear'..i_W-1]+1 .. '–'
							Histyearto_W = Histyearx_W
						else
							Histyearfrom_W = "<="
							Histyearto_W = Histyearx_W
						end
						HistColHeaderx_W = HistColHeaderx_W .. '\n!' .. Histyearfrom_W .. Histyearx_W
					else
						break
					end
					Histyears_W = Histyears_W .. '\n|align="center"|[[Fil:' .. Histflagx_W .. '|33x27px]]'
					i_W=i_W+1
				until not flagdata_W['histyear' .. i_W]
				
			 	-- Henter ut olympiske flagg
				local OLyears_W = ''
				local OLColHeaderx_W = ''
				local j_W = 1
 				repeat
					if flagdata_W['OLyear'..j_W] then
						OLyearx_W = flagdata_W['OLyear'..j_W]
						OLflagx_W = flagdata_W['OLflag'..j_W]
						OLColHeaderx_W = OLColHeaderx_W .. '\n!' .. OLyearx_W
					else
						break
					end
					OLyears_W = OLyears_W .. '\n|align="center"|[[Fil:' .. OLflagx_W .. '|33x27px]]'
					j_W=j_W+1
				until not flagdata_W['OLyear' .. j_W]
				if flagdata_W['histyeara'] then
					histyeara_W = flagdata_W['histyeara']
					histflaga_W = flagdata_W['histflaga']
					ColHeadera_W = '\n!' .. histyeara_W
					yearsa_W = '\n|align="center"|[[Fil:' .. histflaga_W .. '|33x27px]]'
				else
					yearsa_W = ""
					ColHeadera_W = ""
				end
				if flagdata_W['histyearb'] then
					histyearb_W = flagdata_W['histyearb']
					histflagb_W = flagdata_W['histflagb']
					ColHeaderb_W = '\n!' .. histyearb_W
					yearsb_W = '\n|align="center"|[[Fil:' .. histflagb_W .. '|33x27px]]'
				else
					yearsb_W = ""
					ColHeaderb_W = ""
				end
				if flagdata_W['histyearc'] then
					histyearc_W = flagdata_W['histyearc']
					histflagc_W = flagdata_W['histflagc']
					ColHeaderc_W = '\n!' .. histyearc_W
					yearsc_W = '\n|align="center"|[[Fil:' .. histflagc_W .. '|33x27px]]'
				else
					yearsc_W = ""
					ColHeaderc_W = ""
				end
				if flagdata_W['naval'] then
					naval_W = flagdata_W['naval']
					ColHeaderNaval_W = '\n!naval'
					navalflag_W = '\n|align="center"|[[Fil:' .. naval_W .. '|33x27px]]'
				else
					navalflag_W = ""
					ColHeaderNaval_W = ""
				end
				if flagdata_W['airforce'] then
					airforce_W = flagdata_W['airforce']
					ColHeaderAirforce_W = '\n!airforce'
					airforceflag_W = '\n|align="center"|[[Fil:' .. airforce_W .. '|33x27px]]'
				else
					airforceflag_W = ""
					ColHeaderAirforce_W = ""
				end
				if flagdata_W['coastguard'] then
					coastguard_W = flagdata_W['coastguard']
					ColHeaderCoastguard_W = '\n!coastguard'
					coastguardflag_W = '\n|align="center"|[[Fil:' .. coastguard_W .. '|33x27px]]'
				else
					coastguardflag_W = ""
					ColHeaderCoastguard_W = ""
				end
				if flagdata_W['sultanatet'] then
					sultanatet_W = flagdata_W['sultanatet']
					ColHeaderSultanatet_W = '\n!sultanatet'
					sultanatetflag_W = '\n|align="center"|[[Fil:' .. sultanatet_W .. '|33x27px]]'
				else
					sultanatetflag_W = ""
					ColHeaderSultanatet_W = ""
				end
				if flagdata_W['coa'] then
					coa_W = flagdata_W['coa']
					ColHeaderCoa_W = '\n!våpen'
					coaflag_W = '\n|align="center"|[[Fil:' .. coa_W .. '|33x27px]]'
				else
					coaflag_W = ""
					ColHeaderCoa_W = ""
				end
				if flagdata_W['shield'] then
					shield_W = flagdata_W['shield']
					ColHeaderShield_W = '\n!skjold'
					shieldflag_W = '\n|align="center"|[[Fil:' .. shield_W .. '|33x27px]]'
				else
					shieldflag_W = ""
					ColHeaderShield_W = ""
				end
				if flagdata_W['seal'] then
					seal_W = flagdata_W['seal']
					ColHeaderSeal_W = '\n!segl'
					sealflag_W = '\n|align="center"|[[Fil:' .. seal_W .. '|33x27px]]'
				else
					sealflag_W = ""
					ColHeaderSeal_W = ""
				end
				if flagdata_W['football'] then
					football_W = flagdata_W['football']
					ColHeaderFootball_W = '\n!fotball'
					footballflag_W = '\n|align="center"|[[Fil:' .. football_W .. '|33x27px]]'
				else
					footballflag_W = ""
					ColHeaderFootball_W = ""
				end
				if flagdata_W['OLfootball'] then
					olfootball_W = flagdata_W['OLfootball']
					ColHeaderOLFootball_W = '\n!OL (fotball)'
					olfootballflag_W = '\n|align="center"|[[Fil:' .. olfootball_W .. '|33x27px]]'
				else
					olfootballflag_W = ""
					ColHeaderOLFootball_W = ""
				end
			ColEnd_W = '\n|-\n'
			ColYear_W = coaflag_W .. shieldflag_W .. sealflag_W .. Histyears_W .. OLyears_W .. yearsa_W .. yearsb_W .. yearsc_W .. navalflag_W .. airforceflag_W .. coastguardflag_W
						.. sultanatetflag_W .. coaflag_W .. footballflag_W .. olfootballflag_W
			ColHeaderx_W = ColHeaderCoa_W .. ColHeaderShield_W .. ColHeaderSeal_W .. HistColHeaderx_W .. ColHeadera_W .. ColHeaderb_W .. ColHeaderc_W .. OLColHeaderx_W .. ColHeaderNaval_W ..
						ColHeaderAirforce_W .. ColHeaderCoastguard_W .. ColHeaderSultanatet_W .. ColHeaderCoa_W ..
						ColHeaderFootball_W .. ColHeaderOLFootball_W
			TableHeader_W = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_W .. '\n!' .. ColHeader1_W .. '\n!' .. ColHeader2_W .. '\n!' .. ColHeader3_W .. ColHeaderx_W .. '\n' ..
[=[|-
]=]
			TableBottom_W = '|}\n'
			row_W = Col0_W .. Col1_W .. Col2_W .. Col3_W .. ColYear_W .. ColEnd_W
			rows_W = rows_W .. row_W
			Table_W = TableHeader_W .. row_W .. TableBottom_W
			Tables_W = Tables_W .. Table_W
	end
	
	local Tables_X = ''
    local rows_X = ''
    local Areas_X = 0
	for area_X in mw.ustring.gmatch( text, '%[%"X%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_X = string.sub(area_X,3,-8)
    		
    		Areas_X = Areas_X+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_X
			local flagdata_X = require("Modul:Flagg/Masterdata").flagdata[area_X]
			local PageLink_X = flagdata_X.pagelink
			local Name_X = flagdata_X.name
			local DefFlag_X = flagdata_X.defflag
			if PageLink_X == nil then lenke_X = '[[' .. Name_X .. ']]' else lenke_X = '[[' .. PageLink_X .. '|' .. Name_X .. ']]' end
			Col0_X = '|' .. Areas_X .. '\n'
			Col1_X = '|' .. lenke_X .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_X .. '|dok]])</small>\n'
			Col2_X = '|<code>' .. area_X .. '</code>\n'
			Col3_X = '|align="center"|[[Fil:' .. DefFlag_X .. '|33x27px]]'
			ColHeader0_X = '#'
			ColHeader1_X = 'Land'
			ColHeader2_X = 'Argument 1'
			ColHeader3_X = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_X = ''
				local HistColHeaderx_X = ''
				local i_X = 1
 				repeat
					if flagdata_X['histyear'..i_X] then
						Histyearx_X = flagdata_X['histyear'..i_X]
						Histflagx_X = flagdata_X['histflag'..i_X]
						if i_X > 1 then
							Histyearfrom_X = flagdata_X['histyear'..i_X-1]+1 .. '–'
							Histyearto_X = Histyearx_X
						else
							Histyearfrom_X = "<="
							Histyearto_X = Histyearx_X
						end
						HistColHeaderx_X = HistColHeaderx_X .. '\n!' .. Histyearfrom_X .. Histyearx_X
					else
						break
					end
					Histyears_X = Histyears_X .. '\n|align="center"|[[Fil:' .. Histflagx_X .. '|33x27px]]'
					i_X=i_X+1
				until not flagdata_X['histyear' .. i_X]
				
			 	-- Henter ut olympiske flagg
				local OLyears_X = ''
				local OLColHeaderx_X = ''
				local j_X = 1
 				repeat
					if flagdata_X['OLyear'..j_X] then
						OLyearx_X = flagdata_X['OLyear'..j_X]
						OLflagx_X = flagdata_X['OLflag'..j_X]
						OLColHeaderx_X = OLColHeaderx_X .. '\n!' .. OLyearx_X
					else
						break
					end
					OLyears_X = OLyears_X .. '\n|align="center"|[[Fil:' .. OLflagx_X .. '|33x27px]]'
					j_X=j_X+1
				until not flagdata_X['OLyear' .. j_X]
				if flagdata_X['histyeara'] then
					histyeara_X = flagdata_X['histyeara']
					histflaga_X = flagdata_X['histflaga']
					ColHeadera_X = '\n!' .. histyeara_X
					yearsa_X = '\n|align="center"|[[Fil:' .. histflaga_X .. '|33x27px]]'
				else
					yearsa_X = ""
					ColHeadera_X = ""
				end
				if flagdata_X['histyearb'] then
					histyearb_X = flagdata_X['histyearb']
					histflagb_X = flagdata_X['histflagb']
					ColHeaderb_X = '\n!' .. histyearb_X
					yearsb_X = '\n|align="center"|[[Fil:' .. histflagb_X .. '|33x27px]]'
				else
					yearsb_X = ""
					ColHeaderb_X = ""
				end
				if flagdata_X['histyearc'] then
					histyearc_X = flagdata_X['histyearc']
					histflagc_X = flagdata_X['histflagc']
					ColHeaderc_X = '\n!' .. histyearc_X
					yearsc_X = '\n|align="center"|[[Fil:' .. histflagc_X .. '|33x27px]]'
				else
					yearsc_X = ""
					ColHeaderc_X = ""
				end
				if flagdata_X['naval'] then
					naval_X = flagdata_X['naval']
					ColHeaderNaval_X = '\n!naval'
					navalflag_X = '\n|align="center"|[[Fil:' .. naval_X .. '|33x27px]]'
				else
					navalflag_X = ""
					ColHeaderNaval_X = ""
				end
				if flagdata_X['airforce'] then
					airforce_X = flagdata_X['airforce']
					ColHeaderAirforce_X = '\n!airforce'
					airforceflag_X = '\n|align="center"|[[Fil:' .. airforce_X .. '|33x27px]]'
				else
					airforceflag_X = ""
					ColHeaderAirforce_X = ""
				end
				if flagdata_X['coastguard'] then
					coastguard_X = flagdata_X['coastguard']
					ColHeaderCoastguard_X = '\n!coastguard'
					coastguardflag_X = '\n|align="center"|[[Fil:' .. coastguard_X .. '|33x27px]]'
				else
					coastguardflag_X = ""
					ColHeaderCoastguard_X = ""
				end
				if flagdata_X['sultanatet'] then
					sultanatet_X = flagdata_X['sultanatet']
					ColHeaderSultanatet_X = '\n!sultanatet'
					sultanatetflag_X = '\n|align="center"|[[Fil:' .. sultanatet_X .. '|33x27px]]'
				else
					sultanatetflag_X = ""
					ColHeaderSultanatet_X = ""
				end
				if flagdata_X['coa'] then
					coa_X = flagdata_X['coa']
					ColHeaderCoa_X = '\n!våpen'
					coaflag_X = '\n|align="center"|[[Fil:' .. coa_X .. '|33x27px]]'
				else
					coaflag_X = ""
					ColHeaderCoa_X = ""
				end
				if flagdata_X['shield'] then
					shield_X = flagdata_X['shield']
					ColHeaderShield_X = '\n!skjold'
					shieldflag_X = '\n|align="center"|[[Fil:' .. shield_X .. '|33x27px]]'
				else
					shieldflag_X = ""
					ColHeaderShield_X = ""
				end
				if flagdata_X['seal'] then
					seal_X = flagdata_X['seal']
					ColHeaderSeal_X = '\n!segl'
					sealflag_X = '\n|align="center"|[[Fil:' .. seal_X .. '|33x27px]]'
				else
					sealflag_X = ""
					ColHeaderSeal_X = ""
				end
				if flagdata_X['football'] then
					football_X = flagdata_X['football']
					ColHeaderFootball_X = '\n!fotball'
					footballflag_X = '\n|align="center"|[[Fil:' .. football_X .. '|33x27px]]'
				else
					footballflag_X = ""
					ColHeaderFootball_X = ""
				end
				if flagdata_X['OLfootball'] then
					olfootball_X = flagdata_X['OLfootball']
					ColHeaderOLFootball_X = '\n!OL (fotball)'
					olfootballflag_X = '\n|align="center"|[[Fil:' .. olfootball_X .. '|33x27px]]'
				else
					olfootballflag_X = ""
					ColHeaderOLFootball_X = ""
				end
			ColEnd_X = '\n|-\n'
			ColYear_X = coaflag_X .. shieldflag_X .. sealflag_X .. Histyears_X .. OLyears_X .. yearsa_X .. yearsb_X .. yearsc_X .. navalflag_X .. airforceflag_X .. coastguardflag_X
						.. sultanatetflag_X .. coaflag_X .. footballflag_X .. olfootballflag_X
			ColHeaderx_X = ColHeaderCoa_X .. ColHeaderShield_X .. ColHeaderSeal_X .. HistColHeaderx_X .. ColHeadera_X .. ColHeaderb_X .. ColHeaderc_X .. OLColHeaderx_X .. ColHeaderNaval_X ..
						ColHeaderAirforce_X .. ColHeaderCoastguard_X .. ColHeaderSultanatet_X .. ColHeaderCoa_X ..
						ColHeaderFootball_X .. ColHeaderOLFootball_X
			TableHeader_X = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_X .. '\n!' .. ColHeader1_X .. '\n!' .. ColHeader2_X .. '\n!' .. ColHeader3_X .. ColHeaderx_X .. '\n' ..
[=[|-
]=]
			TableBottom_X = '|}\n'
			row_X = Col0_X .. Col1_X .. Col2_X .. Col3_X .. ColYear_X .. ColEnd_X
			rows_X = rows_X .. row_X
			Table_X = TableHeader_X .. row_X .. TableBottom_X
			Tables_X = Tables_X .. Table_X
	end
	
	local Tables_Y = ''
    local rows_Y = ''
    local Areas_Y = 0
	for area_Y in mw.ustring.gmatch( text, '%[%"Y%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_Y = string.sub(area_Y,3,-8)
    		
    		Areas_Y = Areas_Y+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_Y
			local flagdata_Y = require("Modul:Flagg/Masterdata").flagdata[area_Y]
			local PageLink_Y = flagdata_Y.pagelink
			local Name_Y = flagdata_Y.name
			local DefFlag_Y = flagdata_Y.defflag
			if PageLink_Y == nil then lenke_Y = '[[' .. Name_Y .. ']]' else lenke_Y = '[[' .. PageLink_Y .. '|' .. Name_Y .. ']]' end
			Col0_Y = '|' .. Areas_Y .. '\n'
			Col1_Y = '|' .. lenke_Y .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_Y .. '|dok]])</small>\n'
			Col2_Y = '|<code>' .. area_Y .. '</code>\n'
			Col3_Y = '|align="center"|[[Fil:' .. DefFlag_Y .. '|33x27px]]'
			ColHeader0_Y = '#'
			ColHeader1_Y = 'Land'
			ColHeader2_Y = 'Argument 1'
			ColHeader3_Y = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_Y = ''
				local HistColHeaderx_Y = ''
				local i_Y = 1
 				repeat
					if flagdata_Y['histyear'..i_Y] then
						Histyearx_Y = flagdata_Y['histyear'..i_Y]
						Histflagx_Y = flagdata_Y['histflag'..i_Y]
						if i_Y > 1 then
							Histyearfrom_Y = flagdata_Y['histyear'..i_Y-1]+1 .. '–'
							Histyearto_Y = Histyearx_Y
						else
							Histyearfrom_Y = "<="
							Histyearto_Y = Histyearx_Y
						end
						HistColHeaderx_Y = HistColHeaderx_Y .. '\n!' .. Histyearfrom_Y .. Histyearx_Y
					else
						break
					end
					Histyears_Y = Histyears_Y .. '\n|align="center"|[[Fil:' .. Histflagx_Y .. '|33x27px]]'
					i_Y=i_Y+1
				until not flagdata_Y['histyear' .. i_Y]
				
			 	-- Henter ut olympiske flagg
				local OLyears_Y = ''
				local OLColHeaderx_Y = ''
				local j_Y = 1
 				repeat
					if flagdata_Y['OLyear'..j_Y] then
						OLyearx_Y = flagdata_Y['OLyear'..j_Y]
						OLflagx_Y = flagdata_Y['OLflag'..j_Y]
						OLColHeaderx_Y = OLColHeaderx_Y .. '\n!' .. OLyearx_Y
					else
						break
					end
					OLyears_Y = OLyears_Y .. '\n|align="center"|[[Fil:' .. OLflagx_Y .. '|33x27px]]'
					j_Y=j_Y+1
				until not flagdata_Y['OLyear' .. j_Y]
				if flagdata_Y['histyeara'] then
					histyeara_Y = flagdata_Y['histyeara']
					histflaga_Y = flagdata_Y['histflaga']
					ColHeadera_Y = '\n!' .. histyeara_Y
					yearsa_Y = '\n|align="center"|[[Fil:' .. histflaga_Y .. '|33x27px]]'
				else
					yearsa_Y = ""
					ColHeadera_Y = ""
				end
				if flagdata_Y['histyearb'] then
					histyearb_Y = flagdata_Y['histyearb']
					histflagb_Y = flagdata_Y['histflagb']
					ColHeaderb_Y = '\n!' .. histyearb_Y
					yearsb_Y = '\n|align="center"|[[Fil:' .. histflagb_Y .. '|33x27px]]'
				else
					yearsb_Y = ""
					ColHeaderb_Y = ""
				end
				if flagdata_Y['histyearc'] then
					histyearc_Y = flagdata_Y['histyearc']
					histflagc_Y = flagdata_Y['histflagc']
					ColHeaderc_Y = '\n!' .. histyearc_Y
					yearsc_Y = '\n|align="center"|[[Fil:' .. histflagc_Y .. '|33x27px]]'
				else
					yearsc_Y = ""
					ColHeaderc_Y = ""
				end
				if flagdata_Y['naval'] then
					naval_Y = flagdata_Y['naval']
					ColHeaderNaval_Y = '\n!naval'
					navalflag_Y = '\n|align="center"|[[Fil:' .. naval_Y .. '|33x27px]]'
				else
					navalflag_Y = ""
					ColHeaderNaval_Y = ""
				end
				if flagdata_Y['airforce'] then
					airforce_Y = flagdata_Y['airforce']
					ColHeaderAirforce_Y = '\n!airforce'
					airforceflag_Y = '\n|align="center"|[[Fil:' .. airforce_Y .. '|33x27px]]'
				else
					airforceflag_Y = ""
					ColHeaderAirforce_Y = ""
				end
				if flagdata_Y['coastguard'] then
					coastguard_Y = flagdata_Y['coastguard']
					ColHeaderCoastguard_Y = '\n!coastguard'
					coastguardflag_Y = '\n|align="center"|[[Fil:' .. coastguard_Y .. '|33x27px]]'
				else
					coastguardflag_Y = ""
					ColHeaderCoastguard_Y = ""
				end
				if flagdata_Y['sultanatet'] then
					sultanatet_Y = flagdata_Y['sultanatet']
					ColHeaderSultanatet_Y = '\n!sultanatet'
					sultanatetflag_Y = '\n|align="center"|[[Fil:' .. sultanatet_Y .. '|33x27px]]'
				else
					sultanatetflag_Y = ""
					ColHeaderSultanatet_Y = ""
				end
				if flagdata_Y['coa'] then
					coa_Y = flagdata_Y['coa']
					ColHeaderCoa_Y = '\n!våpen'
					coaflag_Y = '\n|align="center"|[[Fil:' .. coa_Y .. '|33x27px]]'
				else
					coaflag_Y = ""
					ColHeaderCoa_Y = ""
				end
				if flagdata_Y['shield'] then
					shield_Y = flagdata_Y['shield']
					ColHeaderShield_Y = '\n!skjold'
					shieldflag_Y = '\n|align="center"|[[Fil:' .. shield_Y .. '|33x27px]]'
				else
					shieldflag_Y = ""
					ColHeaderShield_Y = ""
				end
				if flagdata_Y['seal'] then
					seal_Y = flagdata_Y['seal']
					ColHeaderSeal_Y = '\n!segl'
					sealflag_Y = '\n|align="center"|[[Fil:' .. seal_Y .. '|33x27px]]'
				else
					sealflag_Y = ""
					ColHeaderSeal_Y = ""
				end
				if flagdata_Y['football'] then
					football_Y = flagdata_Y['football']
					ColHeaderFootball_Y = '\n!fotball'
					footballflag_Y = '\n|align="center"|[[Fil:' .. football_Y .. '|33x27px]]'
				else
					footballflag_Y = ""
					ColHeaderFootball_Y = ""
				end
				if flagdata_Y['OLfootball'] then
					olfootball_Y = flagdata_Y['OLfootball']
					ColHeaderOLFootball_Y = '\n!OL (fotball)'
					olfootballflag_Y = '\n|align="center"|[[Fil:' .. olfootball_Y .. '|33x27px]]'
				else
					olfootballflag_Y = ""
					ColHeaderOLFootball_Y = ""
				end
			ColEnd_Y = '\n|-\n'
			ColYear_Y = coaflag_Y .. shieldflag_Y .. sealflag_Y .. Histyears_Y .. OLyears_Y .. yearsa_Y .. yearsb_Y .. yearsc_Y .. navalflag_Y .. airforceflag_Y .. coastguardflag_Y
						.. sultanatetflag_Y .. coaflag_Y .. footballflag_Y .. olfootballflag_Y
			ColHeaderx_Y = ColHeaderCoa_Y .. ColHeaderShield_Y .. ColHeaderSeal_Y .. HistColHeaderx_Y .. ColHeadera_Y .. ColHeaderb_Y .. ColHeaderc_Y .. OLColHeaderx_Y .. ColHeaderNaval_Y ..
						ColHeaderAirforce_Y .. ColHeaderCoastguard_Y .. ColHeaderSultanatet_Y .. ColHeaderCoa_Y ..
						ColHeaderFootball_Y .. ColHeaderOLFootball_Y
			TableHeader_Y = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_Y .. '\n!' .. ColHeader1_Y .. '\n!' .. ColHeader2_Y .. '\n!' .. ColHeader3_Y .. ColHeaderx_Y .. '\n' ..
[=[|-
]=]
			TableBottom_Y = '|}\n'
			row_Y = Col0_Y .. Col1_Y .. Col2_Y .. Col3_Y .. ColYear_Y .. ColEnd_Y
			rows_Y = rows_Y .. row_Y
			Table_Y = TableHeader_Y .. row_Y .. TableBottom_Y
			Tables_Y = Tables_Y .. Table_Y
	end
	
	local Tables_Z = ''
    local rows_Z = ''
    local Areas_Z = 0
	for area_Z in mw.ustring.gmatch( text, '%[%"Z%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_Z = string.sub(area_Z,3,-8)
    		
    		Areas_Z = Areas_Z+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_Z
			local flagdata_Z = require("Modul:Flagg/Masterdata").flagdata[area_Z]
			local PageLink_Z = flagdata_Z.pagelink
			local Name_Z = flagdata_Z.name
			local DefFlag_Z = flagdata_Z.defflag
			if PageLink_Z == nil then lenke_Z = '[[' .. Name_Z .. ']]' else lenke_Z = '[[' .. PageLink_Z .. '|' .. Name_Z .. ']]' end
			Col0_Z = '|' .. Areas_Z .. '\n'
			Col1_Z = '|' .. lenke_Z .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_Z .. '|dok]])</small>\n'
			Col2_Z = '|<code>' .. area_Z .. '</code>\n'
			Col3_Z = '|align="center"|[[Fil:' .. DefFlag_Z .. '|33x27px]]'
			ColHeader0_Z = '#'
			ColHeader1_Z = 'Land'
			ColHeader2_Z = 'Argument 1'
			ColHeader3_Z = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_Z = ''
				local HistColHeaderx_Z = ''
				local i_Z = 1
 				repeat
					if flagdata_Z['histyear'..i_Z] then
						Histyearx_Z = flagdata_Z['histyear'..i_Z]
						Histflagx_Z = flagdata_Z['histflag'..i_Z]
						if i_Z > 1 then
							Histyearfrom_Z = flagdata_Z['histyear'..i_Z-1]+1 .. '–'
							Histyearto_Z = Histyearx_Z
						else
							Histyearfrom_Z = "<="
							Histyearto_Z = Histyearx_Z
						end
						HistColHeaderx_Z = HistColHeaderx_Z .. '\n!' .. Histyearfrom_Z .. Histyearx_Z
					else
						break
					end
					Histyears_Z = Histyears_Z .. '\n|align="center"|[[Fil:' .. Histflagx_Z .. '|33x27px]]'
					i_Z=i_Z+1
				until not flagdata_Z['histyear' .. i_Z]
				
			 	-- Henter ut olympiske flagg
				local OLyears_Z = ''
				local OLColHeaderx_Z = ''
				local j_Z = 1
 				repeat
					if flagdata_Z['OLyear'..j_Z] then
						OLyearx_Z = flagdata_Z['OLyear'..j_Z]
						OLflagx_Z = flagdata_Z['OLflag'..j_Z]
						OLColHeaderx_Z = OLColHeaderx_Z .. '\n!' .. OLyearx_Z
					else
						break
					end
					OLyears_Z = OLyears_Z .. '\n|align="center"|[[Fil:' .. OLflagx_Z .. '|33x27px]]'
					j_Z=j_Z+1
				until not flagdata_Z['OLyear' .. j_Z]
				if flagdata_Z['histyeara'] then
					histyeara_Z = flagdata_Z['histyeara']
					histflaga_Z = flagdata_Z['histflaga']
					ColHeadera_Z = '\n!' .. histyeara_Z
					yearsa_Z = '\n|align="center"|[[Fil:' .. histflaga_Z .. '|33x27px]]'
				else
					yearsa_Z = ""
					ColHeadera_Z = ""
				end
				if flagdata_Z['histyearb'] then
					histyearb_Z = flagdata_Z['histyearb']
					histflagb_Z = flagdata_Z['histflagb']
					ColHeaderb_Z = '\n!' .. histyearb_Z
					yearsb_Z = '\n|align="center"|[[Fil:' .. histflagb_Z .. '|33x27px]]'
				else
					yearsb_Z = ""
					ColHeaderb_Z = ""
				end
				if flagdata_Z['histyearc'] then
					histyearc_Z = flagdata_Z['histyearc']
					histflagc_Z = flagdata_Z['histflagc']
					ColHeaderc_Z = '\n!' .. histyearc_Z
					yearsc_Z = '\n|align="center"|[[Fil:' .. histflagc_Z .. '|33x27px]]'
				else
					yearsc_Z = ""
					ColHeaderc_Z = ""
				end
				if flagdata_Z['naval'] then
					naval_Z = flagdata_Z['naval']
					ColHeaderNaval_Z = '\n!naval'
					navalflag_Z = '\n|align="center"|[[Fil:' .. naval_Z .. '|33x27px]]'
				else
					navalflag_Z = ""
					ColHeaderNaval_Z = ""
				end
				if flagdata_Z['airforce'] then
					airforce_Z = flagdata_Z['airforce']
					ColHeaderAirforce_Z = '\n!airforce'
					airforceflag_Z = '\n|align="center"|[[Fil:' .. airforce_Z .. '|33x27px]]'
				else
					airforceflag_Z = ""
					ColHeaderAirforce_Z = ""
				end
				if flagdata_Z['coastguard'] then
					coastguard_Z = flagdata_Z['coastguard']
					ColHeaderCoastguard_Z = '\n!coastguard'
					coastguardflag_Z = '\n|align="center"|[[Fil:' .. coastguard_Z .. '|33x27px]]'
				else
					coastguardflag_Z = ""
					ColHeaderCoastguard_Z = ""
				end
				if flagdata_Z['sultanatet'] then
					sultanatet_Z = flagdata_Z['sultanatet']
					ColHeaderSultanatet_Z = '\n!sultanatet'
					sultanatetflag_Z = '\n|align="center"|[[Fil:' .. sultanatet_Z .. '|33x27px]]'
				else
					sultanatetflag_Z = ""
					ColHeaderSultanatet_Z = ""
				end
				if flagdata_Z['coa'] then
					coa_Z = flagdata_Z['coa']
					ColHeaderCoa_Z = '\n!våpen'
					coaflag_Z = '\n|align="center"|[[Fil:' .. coa_Z .. '|33x27px]]'
				else
					coaflag_Z = ""
					ColHeaderCoa_Z = ""
				end
				if flagdata_Z['shield'] then
					shield_Z = flagdata_Z['shield']
					ColHeaderShield_Z = '\n!skjold'
					shieldflag_Z = '\n|align="center"|[[Fil:' .. shield_Z .. '|33x27px]]'
				else
					shieldflag_Z = ""
					ColHeaderShield_Z = ""
				end
				if flagdata_Z['seal'] then
					seal_Z = flagdata_Z['seal']
					ColHeaderSeal_Z = '\n!segl'
					sealflag_Z = '\n|align="center"|[[Fil:' .. seal_Z .. '|33x27px]]'
				else
					sealflag_Z = ""
					ColHeaderSeal_Z = ""
				end
				if flagdata_Z['football'] then
					football_Z = flagdata_Z['football']
					ColHeaderFootball_Z = '\n!fotball'
					footballflag_Z = '\n|align="center"|[[Fil:' .. football_Z .. '|33x27px]]'
				else
					footballflag_Z = ""
					ColHeaderFootball_Z = ""
				end
				if flagdata_Z['OLfootball'] then
					olfootball_Z = flagdata_Z['OLfootball']
					ColHeaderOLFootball_Z = '\n!OL (fotball)'
					olfootballflag_Z = '\n|align="center"|[[Fil:' .. olfootball_Z .. '|33x27px]]'
				else
					olfootballflag_Z = ""
					ColHeaderOLFootball_Z = ""
				end
			ColEnd_Z = '\n|-\n'
			ColYear_Z = coaflag_Z .. shieldflag_Z .. sealflag_Z .. Histyears_Z .. OLyears_Z .. yearsa_Z .. yearsb_Z .. yearsc_Z .. navalflag_Z .. airforceflag_Z .. coastguardflag_Z
						.. sultanatetflag_Z .. coaflag_Z .. footballflag_Z .. olfootballflag_Z
			ColHeaderx_Z = ColHeaderCoa_Z .. ColHeaderShield_Z .. ColHeaderSeal_Z .. HistColHeaderx_Z .. ColHeadera_Z .. ColHeaderb_Z .. ColHeaderc_Z .. OLColHeaderx_Z .. ColHeaderNaval_Z ..
						ColHeaderAirforce_Z .. ColHeaderCoastguard_Z .. ColHeaderSultanatet_Z .. ColHeaderCoa_Z ..
						ColHeaderFootball_Z .. ColHeaderOLFootball_Z
			TableHeader_Z = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_Z .. '\n!' .. ColHeader1_Z .. '\n!' .. ColHeader2_Z .. '\n!' .. ColHeader3_Z .. ColHeaderx_Z .. '\n' ..
[=[|-
]=]
			TableBottom_Z = '|}\n'
			row_Z = Col0_Z .. Col1_Z .. Col2_Z .. Col3_Z .. ColYear_Z .. ColEnd_Z
			rows_Z = rows_Z .. row_Z
			Table_Z = TableHeader_Z .. row_Z .. TableBottom_Z
			Tables_Z = Tables_Z .. Table_Z
	end
	
	local Tables_Other = ''
    local rows_Other = ''
    local Areas_Other = 0
	for area_Other in mw.ustring.gmatch( text, '%[%"[ÆØÅÄËÏÖÜÂÊÎÔÛÃÕÀÈÌÒÙÁÉÍÓÚÝŌ]%a*%s?%p?%s?%-?%(?%a*%s?%a*%)?%p?%s?%-?%a*%s?%-?%a*%s?%-?%(?%a*%)?%p?%s?%a*%s?%a*%"%] %= %{\n') do
    	area_Other = string.sub(area_Other,3,-8)
    		
    		Areas_Other = Areas_Other+1
			-- Henter ut nødvendige data fra undersider basert på første bokstav i områdets fulle navn
			frame.args[1] = area_Other
			local flagdata_Other = require("Modul:Flagg/Masterdata").flagdata[area_Other]
			local PageLink_Other = flagdata_Other.pagelink
			local Name_Other = flagdata_Other.name
			local DefFlag_Other = flagdata_Other.defflag
			if PageLink_Other == nil then lenke_Other = '[[' .. Name_Other .. ']]' else lenke_Other = '[[' .. PageLink_Other .. '|' .. Name_Other .. ']]' end
			Col0_Other = '|' .. Areas_Other .. '\n'
			Col1_Other = '|' .. lenke_Other .. '&nbsp;<small>([[Modul:Flagg/data/' .. area_Other .. '|dok]])</small>\n'
			Col2_Other = '|<code>' .. area_Other .. '</code>\n'
			Col3_Other = '|align="center"|[[Fil:' .. DefFlag_Other .. '|33x27px]]'
			ColHeader0_Other = '#'
			ColHeader1_Other = 'Land'
			ColHeader2_Other = 'Argument 1'
			ColHeader3_Other = 'Standard'
			
			 	-- Henter ut historiske flagg
				local Histyears_Other = ''
				local HistColHeaderx_Other = ''
				local i_Other = 1
 				repeat
					if flagdata_Other['histyear'..i_Other] then
						Histyearx_Other = flagdata_Other['histyear'..i_Other]
						Histflagx_Other = flagdata_Other['histflag'..i_Other]
						if i_Other > 1 then
							Histyearfrom_Other = flagdata_Other['histyear'..i_Other-1]+1 .. '–'
							Histyearto_Other = Histyearx_Other
						else
							Histyearfrom_Other = "<="
							Histyearto_Other = Histyearx_Other
						end
						HistColHeaderx_Other = HistColHeaderx_Other .. '\n!' .. Histyearfrom_Other .. Histyearx_Other
					else
						break
					end
					Histyears_Other = Histyears_Other .. '\n|align="center"|[[Fil:' .. Histflagx_Other .. '|33x27px]]'
					i_Other=i_Other+1
				until not flagdata_Other['histyear' .. i_Other]
				
			 	-- Henter ut olympiske flagg
				local OLyears_Other = ''
				local OLColHeaderx_Other = ''
				local j_Other = 1
 				repeat
					if flagdata_Other['OLyear'..j_Other] then
						OLyearx_Other = flagdata_Other['OLyear'..j_Other]
						OLflagx_Other = flagdata_Other['OLflag'..j_Other]
						OLColHeaderx_Other = OLColHeaderx_Other .. '\n!' .. OLyearx_Other
					else
						break
					end
					OLyears_Other = OLyears_Other .. '\n|align="center"|[[Fil:' .. OLflagx_Other .. '|33x27px]]'
					j_Other=j_Other+1
				until not flagdata_Other['OLyear' .. j_Other]
				if flagdata_Other['histyeara'] then
					histyeara_Other = flagdata_Other['histyeara']
					histflaga_Other = flagdata_Other['histflaga']
					ColHeadera_Other = '\n!' .. histyeara_Other
					yearsa_Other = '\n|align="center"|[[Fil:' .. histflaga_Other .. '|33x27px]]'
				else
					yearsa_Other = ""
					ColHeadera_Other = ""
				end
				if flagdata_Other['histyearb'] then
					histyearb_Other = flagdata_Other['histyearb']
					histflagb_Other = flagdata_Other['histflagb']
					ColHeaderb_Other = '\n!' .. histyearb_Other
					yearsb_Other = '\n|align="center"|[[Fil:' .. histflagb_Other .. '|33x27px]]'
				else
					yearsb_Other = ""
					ColHeaderb_Other = ""
				end
				if flagdata_Other['histyearc'] then
					histyearc_Other = flagdata_Other['histyearc']
					histflagc_Other = flagdata_Other['histflagc']
					ColHeaderc_Other = '\n!' .. histyearc_Other
					yearsc_Other = '\n|align="center"|[[Fil:' .. histflagc_Other .. '|33x27px]]'
				else
					yearsc_Other = ""
					ColHeaderc_Other = ""
				end
				if flagdata_Other['naval'] then
					naval_Other = flagdata_Other['naval']
					ColHeaderNaval_Other = '\n!naval'
					navalflag_Other = '\n|align="center"|[[Fil:' .. naval_Other .. '|33x27px]]'
				else
					navalflag_Other = ""
					ColHeaderNaval_Other = ""
				end
				if flagdata_Other['airforce'] then
					airforce_Other = flagdata_Other['airforce']
					ColHeaderAirforce_Other = '\n!airforce'
					airforceflag_Other = '\n|align="center"|[[Fil:' .. airforce_Other .. '|33x27px]]'
				else
					airforceflag_Other = ""
					ColHeaderAirforce_Other = ""
				end
				if flagdata_Other['coastguard'] then
					coastguard_Other = flagdata_Other['coastguard']
					ColHeaderCoastguard_Other = '\n!coastguard'
					coastguardflag_Other = '\n|align="center"|[[Fil:' .. coastguard_Other .. '|33x27px]]'
				else
					coastguardflag_Other = ""
					ColHeaderCoastguard_Other = ""
				end
				if flagdata_Other['sultanatet'] then
					sultanatet_Other = flagdata_Other['sultanatet']
					ColHeaderSultanatet_Other = '\n!sultanatet'
					sultanatetflag_Other = '\n|align="center"|[[Fil:' .. sultanatet_Other .. '|33x27px]]'
				else
					sultanatetflag_Other = ""
					ColHeaderSultanatet_Other = ""
				end
				if flagdata_Other['coa'] then
					coa_Other = flagdata_Other['coa']
					ColHeaderCoa_Other = '\n!våpen'
					coaflag_Other = '\n|align="center"|[[Fil:' .. coa_Other .. '|33x27px]]'
				else
					coaflag_Other = ""
					ColHeaderCoa_Other = ""
				end
				if flagdata_Other['shield'] then
					shield_Other = flagdata_Other['shield']
					ColHeaderShield_Other = '\n!skjold'
					shieldflag_Other = '\n|align="center"|[[Fil:' .. shield_Other .. '|33x27px]]'
				else
					shieldflag_Other = ""
					ColHeaderShield_Other = ""
				end
				if flagdata_Other['seal'] then
					seal_Other = flagdata_Other['seal']
					ColHeaderSeal_Other = '\n!segl'
					sealflag_Other = '\n|align="center"|[[Fil:' .. seal_Other .. '|33x27px]]'
				else
					sealflag_Other = ""
					ColHeaderSeal_Other = ""
				end
				if flagdata_Other['football'] then
					football_Other = flagdata_Other['football']
					ColHeaderFootball_Other = '\n!fotball'
					footballflag_Other = '\n|align="center"|[[Fil:' .. football_Other .. '|33x27px]]'
				else
					footballflag_Other = ""
					ColHeaderFootball_Other = ""
				end
				if flagdata_Other['OLfootball'] then
					olfootball_Other = flagdata_Other['OLfootball']
					ColHeaderOLFootball_Other = '\n!OL (fotball)'
					olfootballflag_Other = '\n|align="center"|[[Fil:' .. olfootball_Other .. '|33x27px]]'
				else
					olfootballflag_Other = ""
					ColHeaderOLFootball_Other = ""
				end
			ColEnd_Other = '\n|-\n'
			ColYear_Other = coaflag_Other .. shieldflag_Other .. sealflag_Other .. Histyears_Other .. OLyears_Other .. yearsa_Other .. yearsb_Other .. yearsc_Other .. navalflag_Other .. airforceflag_Other .. coastguardflag_Other
						.. sultanatetflag_Other .. coaflag_Other .. footballflag_Other .. olfootballflag_Other
			ColHeaderx_Other = ColHeaderCoa_Other .. ColHeaderShield_Other .. ColHeaderSeal_Other .. HistColHeaderx_Other .. ColHeadera_Other .. ColHeaderb_Other .. ColHeaderc_Other .. OLColHeaderx_Other .. ColHeaderNaval_Other ..
						ColHeaderAirforce_Other .. ColHeaderCoastguard_Other .. ColHeaderSultanatet_Other .. ColHeaderCoa_Other ..
						ColHeaderFootball_Other .. ColHeaderOLFootball_Other
			TableHeader_Other = '\n' ..
[=[{| class="wikitable"
|-
!]=] .. ColHeader0_Other .. '\n!' .. ColHeader1_Other .. '\n!' .. ColHeader2_Other .. '\n!' .. ColHeader3_Other .. ColHeaderx_Other .. '\n' ..
[=[|-
]=]
			TableBottom_Other = '|}\n'
			row_Other = Col0_Other .. Col1_Other .. Col2_Other .. Col3_Other .. ColYear_Other .. ColEnd_Other
			rows_Other = rows_Other .. row_Other
			Table_Other = TableHeader_Other .. row_Other .. TableBottom_Other
			Tables_Other = Tables_Other .. Table_Other
	end
	
	local Navbox_A = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'A', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;A&nbsp;(' .. Areas_A .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] = 'Under vises flagg for de områder som begynner på bokstaven A.<br />' 
					.. Tables_A,
					} };
	local Navbox_B = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'B', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;B&nbsp;(' .. Areas_B .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven B.<br />' 
					.. Tables_B,
					} };
	local Navbox_C = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'C', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;C&nbsp;(' .. Areas_C .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven C.<br />' 
					.. Tables_C,
					} };
	local Navbox_D = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'D', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;D&nbsp;(' .. Areas_D .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven D.<br />' 
					.. Tables_D,
					} };
	local Navbox_E = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'E', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;E&nbsp;(' .. Areas_E .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven E.<br />' 
					.. Tables_E,
					} };
	local Navbox_F = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'F', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;F&nbsp;(' .. Areas_F .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven F.<br />' 
					.. Tables_F,
					} };
	local Navbox_G = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'G', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;G&nbsp;(' .. Areas_G .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven G.<br />' 
					.. Tables_G,
					} };
	local Navbox_H = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'H', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;H&nbsp;(' .. Areas_H .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven H.<br />' 
					.. Tables_H,
					} };
	local Navbox_I = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'I', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;I&nbsp;(' .. Areas_I .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven I.<br />' 
					.. Tables_I,
					} };
	local Navbox_J = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'J', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;J&nbsp;(' .. Areas_J .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven J.<br />' 
					.. Tables_J,
					} };
	local Navbox_K = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'K', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;K&nbsp;(' .. Areas_K .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven K.<br />' 
					.. Tables_K,
					} };
	local Navbox_L = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'L', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;L&nbsp;(' .. Areas_L .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven L.<br />' 
					.. Tables_L,
					} };
	local Navbox_M = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'M', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;M&nbsp;(' .. Areas_M .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven M.<br />' 
					.. Tables_M,
					} };
	local Navbox_N = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'N', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;N&nbsp;(' .. Areas_N .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven N.<br />' 
					.. Tables_N,
					} };
	local Navbox_O = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'O', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;O&nbsp;(' .. Areas_O .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven O.<br />' 
					.. Tables_O,
					} };
	local Navbox_P = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'P', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;P&nbsp;(' .. Areas_P .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven P.<br />' 
					.. Tables_P,
					} };
	local Navbox_Q = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'Q', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;Q&nbsp;(' .. Areas_Q .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven Q.<br />' 
					.. Tables_Q,
					} };
	local Navbox_R = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'R', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;R&nbsp;(' .. Areas_R .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven R.<br />' 
					.. Tables_R,
					} };
	local Navbox_S = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'S', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;S&nbsp;(' .. Areas_S .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven S.<br />' 
					.. Tables_S,
					} };
	local Navbox_T = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'T', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;T&nbsp;(' .. Areas_T .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven T.<br />' 
					.. Tables_T,
					} };
	local Navbox_U = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'U', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;U&nbsp;(' .. Areas_U .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven U.<br />' 
					.. Tables_U,
					} };
	local Navbox_V = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'V', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;V&nbsp;(' .. Areas_V .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven V.<br />' 
					.. Tables_V,
					} };
	local Navbox_W = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'W', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;W&nbsp;(' .. Areas_W .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven W.<br />' 
					.. Tables_W,
					} };
	local Navbox_X = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'X', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;X&nbsp;(' .. Areas_X .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven X.<br />' 
					.. Tables_X,
					} };
	local Navbox_Y = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'Y', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;Y&nbsp;(' .. Areas_Y .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven Y.<br />' 
					.. Tables_Y,
					} };
	local Navbox_Z = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'Z', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;Z&nbsp;(' .. Areas_Z .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på bokstaven Z.<br />' 
					.. Tables_Z,
					} };
	local Navbox_Other = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'Other', 
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;for&nbsp;områder&nbsp;på&nbsp;andre&nbsp;bokstaver&nbsp;(' .. Areas_Other .. '&nbsp;områder)', 
					['navbar'] = 'plain',
					['status'] = 'collapsed',
					['liste1'] =  'Under vises flagg for de områder som begynner på andre bokstaver.<br />' 
					.. Tables_Other,
					} };
					
	local sum_areas = Areas_A + Areas_B + Areas_C + Areas_D + Areas_E + Areas_F + Areas_G + Areas_H + Areas_I + Areas_J + Areas_K + Areas_L + Areas_M + Areas_N
					+ Areas_O + Areas_P + Areas_Q + Areas_R + Areas_S + Areas_T + Areas_U + Areas_V + Areas_W + Areas_X + Areas_Y + Areas_Z + Areas_Other
	local box = mw.getCurrentFrame():expandTemplate{ title = 'Navboks', args = { 
					['navn'] = 'Alle',
					['tittel'] = 'Registrerte&nbsp;flagg&nbsp;(' .. sum_areas .. ')',
					['navbar'] = 'plain',
					['liste1'] = Navbox_A,
					['liste2'] = Navbox_B,
					['liste3'] = Navbox_C,
					['liste4'] = Navbox_D,
					['liste5'] = Navbox_E,
					['liste6'] = Navbox_F,
					['liste7'] = Navbox_G,
					['liste8'] = Navbox_H,
					['liste9'] = Navbox_I,
					['liste10'] = Navbox_J,
					['liste11'] = Navbox_K,
					['liste12'] = Navbox_L,
					['liste13'] = Navbox_M,
					['liste14'] = Navbox_N,
					['liste15'] = Navbox_O,
					['liste16'] = Navbox_P,
					['liste17'] = Navbox_Q,
					['liste18'] = Navbox_R,
					['liste19'] = Navbox_S,
					['liste20'] = Navbox_T,
					['liste21'] = Navbox_U,
					['liste22'] = Navbox_V,
					['liste23'] = Navbox_W,
					['liste24'] = Navbox_X,
					['liste25'] = Navbox_Y,
					['liste26'] = Navbox_Z,
					['liste27'] = Navbox_Other,
					} };
	retval = box
	
	return retval
end

return p