Module:Sandbox/Soreness

From Growtopia
Revision as of 14:25, 27 April 2022 by >Sorenesss
Jump to navigationJump to search

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

local p = {}

local md5 = require('Module:Md5')

local sc = {}
local f = {}
local printset = {}

local function getItemData(hash)
    local a = mw.loadData('Module:Item/Data')
    return a[hash] or {-1, -1}
end

local function addToSet(set, key)
    set[key] = true
end

local function removeFromSet(set, key)
    set[key] = nil
end

local function setContains(set, key)
    return set[key] ~= nil
end

local function addtoList(frame)
	local name = frame.args["name"] or mw.title.getCurrentTitle().text
	local d = getItemData(md5.md5(name))
	if not setConatains(f, d[3]) then
		addToSet(f, d[3])
		table.setn(sc,getn(sc)+1)
		table.setn(sc[d[3]],1)
		table.insert(sc[d[3]],"'''Rarity "..i..":'''<br>")
	end
	table.setn(sc[d[3]], getn(sc[d[3]])+1)
	table.insert(s[d[3]],"[["..name.."]]")
end

function p.ListRaritys()
	for i=1, table.getn(sc), 1
	do
		for j=1,table.getn(sc[i]), 1
		do
			table.insert(printset, sc[i][j])	
		end
	end
	return table.concat(printset)
end

return p