Jump to content

Module:Set to list: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
create meta-module
(No difference)

Revision as of 00:15, 29 May 2025

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