Jump to content

မေႃႇၵျူး:table/invert

လုၵ်ႉတီႈ ဝိၵ်ႇသျိၼ်ႇၼရီႇ မႃး

Documentation for this module may be created at မေႃႇၵျူး:table/invert/doc

local pairs = pairs

--[==[
Invert a table. For example, {invert({ "a", "b", "c" })} -> { { a = 1, b = 2, c = 3 }}]==]
return function(t)
	local map = {}
	for k, v in pairs(t) do
		map[v] = k
	end
	return map
end