mod-cleaner/misc_functions.lua
2021-05-26 20:55:00 -07:00

26 lines
357 B
Lua

--- Cleans duplicate entries from indexed table.
--
-- @local
-- @function clean_duplicates
-- @tparam table t
-- @treturn table
local function clean_duplicates(t)
local tmp = {}
for _, v in ipairs(t) do
tmp[v] = true
end
t = {}
for k in pairs(tmp) do
table.insert(t, k)
end
return t
end
return {
clean_duplicates = clean_duplicates,
}