Modul:Infobox3cols
-- Get arguments with number suffixes. local a = 0 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do       moreArgumentsExist = false for i = a, a + step - 1 do           for j,v in ipairs(prefixTable) do                local prefixArgName = v.prefix .. tostring(i) .. (v.suffix or '') if origArgs[prefixArgName] then moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones. preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present and not blank, or               -- we are processing "prefix1" and "prefix" is present and not blank, and -- if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do                       local dependArgName = dependValue .. tostring(i) .. (v.dependsuffix or '') preprocessSingleArg(dependArgName) end end end end a = a + step end end function p.infobox(frame) -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. if frame == mw.getCurrentFrame then origArgs = frame:getParent.args else origArgs = frame end -- Parse the data parameters in the same order that the old did, so that -- references etc. will display in the expected places. Parameters that depend on   -- another parameter are only processed if that parameter is present, to avoid -- phantom references appearing in article reference lists. preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({       {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}    }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessSingleArg('image') preprocessSingleArg('caption') preprocessArgs({       {prefix = 'image', depend = {'caption', 'imagerowclass'}}    }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({       {prefix = 'header'},        {prefix = 'data', depend = {'label'}},        {prefix = 'data', suffix = 'a', depend = {'label'}},        {prefix = 'data', suffix = 'a', depend = {'data'}, dependsuffix='c'},        {prefix = 'data', suffix = 'b', depend = {'label'}},        {prefix = 'data', suffix = 'b', depend = {'data'}, dependsuffix='c'},        {prefix = 'rowclass'},        {prefix = 'rowstyle'},        {prefix = 'rowcellstyle'},        {prefix = 'class'},        {prefix = 'dataid'},        {prefix = 'labelid'},        {prefix = 'headerid'},        {prefix = 'rowid'}    }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('datastylea') preprocessSingleArg('datastyleb') preprocessSingleArg('datastylec') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent preprocessSingleArg('decat') return _infobox end return p