Module:Components

local phase = 0 -- Allows to make 2 phases of inserting the info -- Start of the actual module local p = {}

-- Start of the main function function p.main( f ) local args = f		if f == mw.getCurrentFrame then args = f:getParent.args end local items = args[1] or '' local components = {} for component in mw.text.gsplit( items, '%s*;%s*' ) do -- This seperates component name from component amount. if component == '' then table.insert( components, '  ' ) else -- Phase 0 (componentName) if phase == 0 then --print("The Phase 1 of 2 of function 'main' in a module 'Module:Components' is starting.") table.insert( components, '   '..component..'') --print("Table printed") else -- Phase 1 (componentAmount) table.insert( components, ' '..component..' ') end --table.insert( components, ' '..textOutput..' ' ) phase = phase + 1 end end components[1] = components[1]:gsub( '^ ', ' ' ) return ' ' .. table.concat( components ) .. ' '	end function p.componentName( f ) local args = f		if f == mw.getCurrentFrame then args = f:getParent.args end local items = args[1] or '' local components = {} for component in mw.text.gsplit( items, '%s*;%s*' ) do -- This seperates component name from component amount. if component == '' then table.insert( components, '  ' ) else if phase == 0 then table.insert( components, ..component..) end phase = phase + 1 end end components[1] = components[1]:gsub( '^ ', ' ' ) return '' .. table.concat( components ) .. ''	end function p.componentAmount( f ) local args = f		if f == mw.getCurrentFrame then args = f:getParent.args end local items = args[1] or '' local components = {} for component in mw.text.gsplit( items, '%s*;%s*' ) do -- This seperates component name from component amount. if component == '' then table.insert( components, '  ' ) else if phase == 1 then table.insert( components, ..component..) end phase = phase + 1 end end components[1] = components[1]:gsub( '^ ', ' ' ) return '' .. table.concat( components ) .. ''	end return p