Module:NHClothingIDList

From Nookipedia, the Animal Crossing wiki

Documentation for this module may be created at Module:NHClothingIDList/doc

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

function split(str, pattern)
    local out = {}
    for m in string.gmatch(str, "[^" .. pattern .. "]+") do
      table.insert(out, m)
    end
    return out
end

function p.main(frame)
    local args       = getArgs(frame)
    local listOfList = split( args[1], "," ) or ''
    return p.listFormat(listOfList)
end

function p.listFormat(listOfList)
	local listOf = ''
	for l = 1, #listOfList do
        listOf = listOf .. '<code>' .. listOfList[l]
        if tonumber(listOfList[l]) > 9999 then
        	if l == 3 then
        		listOf = listOf .. '</code><br>'
        	else
        		listOf = listOf .. '</code>, '
        	end
        elseif l == #listOfList then
        	listOf = listOf .. '</code>'
        elseif l == 4 then
        	listOf = listOf .. '</code><br>'
        else
        	listOf = listOf .. '</code>, '
        end
	end
	return listOf
end

return p