Jump to content

Module:Set to list: Difference between revisions

From Wikipedia, the free encyclopedia
better
m 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))
 
(No difference)

Latest revision as of 18:00, 1 June 2025

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