Jump to content

Module:Set to list

Permanently protected module
From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by MusikBot II (talk | contribs) at 18:00, 1 June 2025 (Protected "Module:Set to list": High-risk template or module: 13030 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

-- 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