Module:Loops

local p = {}

function p.generatePageLinkList( frame ) --Get parameters passed into the calling template local templateArgs = frame:getParent.args local concatTable = {} --{{{namespace|{{{n|{{{ns|{{{1 --Limit to 100 because we need to treat the nice wiki well and not lag it :)	local i = frame.args[1] and 2 or 1	while i < 101 do		if templateArgs[i] then			table.insert( concatTable, "*" .. frame.args[1] .. ":" .. templateArgs[i]				.. " \n" )		else			mw.text.trim(concatTable[#concatTable])			break		end		i = i+1	end	return table.concat(concatTable) end

function p.characterStatusString(frame, args) local common = require( "Module:Common" ) local margin = ' ' local hr = '' local death = frame:expandTemplate{ title="Status", args={ "D" } } local activeCharacters = {} local inactiveCharacters = {} local deceasedCharacters = {} local unknownCharacters = {} local i = frame:getParent.args["player"] and 1 or 2 while frame:getParent.args[i] do		local c = mw.text.trim( frame:getParent.args[i] ) local s = common.getCharacterStatus( c ) if s ~= "Deceased" then table.insert(( s == "Active" and activeCharacters or ( s == "Inactive" and inactiveCharacters or (s == "Unknown" and unknownCharacters) ) ), ( ' ' or '') .. c .. ' ' .. ' • ' )) elseif s == "Deceased" then table.insert( deceasedCharacters, ' ' or '') .. c .. ' ' .. death .. ' • ' ) else error( "The character page for " .. c .. " either doesn't exist, or doesn't have the `Infobox Character` template implemented" ) end i = i+1 end if #activeCharacters > 0 then activeCharacters[#activeCharacters] = string.gsub( activeCharacters[#activeCharacters], "• ", " " ) end if #inactiveCharacters > 0 then inactiveCharacters[#inactiveCharacters] = string.gsub( inactiveCharacters[#inactiveCharacters], "• ", " " ) end if #deceasedCharacters > 0 then deceasedCharacters[#deceasedCharacters] = string.gsub( deceasedCharacters[#deceasedCharacters], "• ", " " ) end if #unknownCharacters > 0 then unknownCharacters[#unknownCharacters] = string.gsub( unknownCharacters[#unknownCharacters], "• ", " " ) end local activeOutput = ( #activeCharacters > 0 and ( ' ' .. ( ( args["tabbed"] ~= 'true' ) and ( 'Active Characters: ' ) or '' ) .. margin .. table.concat( activeCharacters ) ) .. ' ' .. ( ( args["tabbed"] ~= 'true' and ( #inactiveCharacters > 0 or #deceasedCharacters > 0 or #unknownCharacters > 0 ) ) and hr or "" ) ) or "" local inactiveOutput = ( #inactiveCharacters > 0 and ( ' ' .. ( ( args["tabbed"] ~= 'true' ) and ( 'Inactive Characters: ' ) or '' ) .. margin .. table.concat( inactiveCharacters ) ) .. ' ' .. ( ( args["tabbed"] ~= 'true' and ( #deceasedCharacters > 0 or #unknownCharacters > 0 ) ) and hr or "" ) ) or "" local deceasedOutput = ( #deceasedCharacters > 0 and ( ' ' .. ( ( args["tabbed"] ~= 'true' ) and ( 'Deceased Characters: ' ) or '' ) .. margin .. table.concat( deceasedCharacters ) ) .. ' ' .. ( ( args["tabbed"] ~= 'true' and ( #unknownCharacters > 0 ) ) and hr or "" ) ) or "" local unknownOutput = ( #unknownCharacters > 0 and ( ' ' .. ( ( args["tabbed"] ~= 'true' ) and ( 'Other Characters: ' ) or '' ) .. margin .. table.concat( unknownCharacters ) ) .. ' ' ) or "" if args["tabbed"] == 'true' then local parserArgs = { } --table.insert(parserArgs,		activeOutput = ( ( activeOutput ~= "" ) and "Active=" .. activeOutput .. ( ( unknownOutput ~= "" or deceasedOutput ~= "" or inactiveOutput ~= "" ) and '|-|' or  ) or )		inactiveOutput = ( ( inactiveOutput ~= "" ) and "Inactive=" .. inactiveOutput .. ( ( unknownOutput ~= "" or deceasedOutput ~= "" ) and '|-|' or  ) or  )		deceasedOutput = ( ( deceasedOutput ~= "" ) and "Deceased=" .. deceasedOutput .. ( ( unknownOutput ~= "" ) and '|-|' or  ) or )		unknownOutput = ( ( unknownOutput ~= "" ) and "Other=" .. unknownOutput or '' )		--) if activeOutput ~= "" then table.insert(parserArgs, activeOutput) end if inactiveOutput ~= "" then table.insert(parserArgs, inactiveOutput) end if deceasedOutput ~= "" then table.insert(parserArgs, deceasedOutput) end if unknownOutput ~= "" then table.insert(parserArgs, unknownOutput) end return frame:callParserFunction{ name="#tag:tabber", args={ table.concat(parserArgs) }}--args={ 'Active= Active Characters:  |-|Inactive= Inactive Characters:   |-|Deceased=TEST|-|Other=TEST' }}--args={ activeOutput, inactiveOutput, deceasedOutput, unknownOutput } }--parserArgs } else return ' ' .. activeOutput .. inactiveOutput .. deceasedOutput .. unknownOutput .. ' '	end end

return p