Jump to content

Module:Set to list

Permanently protected module
From Wikipedia, the free encyclopedia

-- Converts a set (table with values as true) to a list (array of keys)
return function (set)
	local list = {}
	for key, value in pairs(set) do
		if value then
			table.insert(list, key)
		end
	end
	table.sort(list)
	return list
end