Module:Appear

local p = {} -- Create a table t to hold the data from Module:Appear/data local t = mw.loadData( 'Module:Appear/data' ) -- Create a table to see which seasons have been written and which haven't local seasons = {}

-- Sends the arguments given to the template to the write function -- and returns everything put together into a string function p.main( frame ) local text = "" for i, v in ipairs( frame:getParent.args ) do       text = text .. write( v ) end return text end

-- Splits the argument into pieces and sends the right pieces to -- writeSeason, writeEpisode, and writeSidenote -- They are then put together and returned local function write( arg ) local seasoncode = "" local episodecode = "" local sidenotecode = "" local first = arg:sub( 1, 1 ) if toNumber( first ) then seasoncode = first episodecode = arg:sub( 1, 3 ) sidenotecode = arg:sub( 4 ) elseif first == 'a' then seasoncode = arg:sub( 4 ) episodecode = arg elseif first == 'i' then episodecode = 'intro' elseif first == 's' then seasoncode = 'short' episodecode = arg:sub( 1, 7 ) sidenotecode = arg:sub( 8 ) else local lowerIndex = arg:find( '%l' ) seasoncode = 'game' episodecode = arg:sub( 1, lowerIndex - 1 ) sidenotecode = arg:sub( lowerIndex ) end local season = writeSeason( seasoncode ) local episode = writeEpisode( episodecode ) local sidenote = writeSidenote( sidenotecode ) return season .. episode .. sidenote end

return p