Jump to content

Module:Set to list

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by HouseBlaster (talk | contribs) at 00:15, 29 May 2025 (create meta-module). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

-- Converts a set (table with values as true) to a list (array of keys)
function p.setToList(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

return p