2021-05-18 20:11:38 -07:00
|
|
|
|
2021-05-26 20:55:00 -07:00
|
|
|
--- Cleans duplicate entries from indexed table.
|
|
|
|
--
|
|
|
|
-- @local
|
|
|
|
-- @function clean_duplicates
|
|
|
|
-- @tparam table t
|
|
|
|
-- @treturn table
|
2021-05-18 20:11:38 -07:00
|
|
|
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,
|
|
|
|
}
|