diff --git a/README.md b/README.md index b8035e1..281f476 100644 --- a/README.md +++ b/README.md @@ -135,10 +135,8 @@ an error is raised, lume.reduce({1, 2, 3}, function(a, b) return a + b end) -- Returns 6 ``` -### lume.set(t [, retainkeys]) -Returns a copy of the `t` table with all the duplicate values removed. If -`retainkeys` is true the table is not treated as an array and retains its -original keys. +### lume.set(t) +Returns a copy of the `t` array with all the duplicate values removed. ```lua lume.set({2, 1, 2, "cat", "cat"}) -- Returns {1, 2, "cat"} ``` diff --git a/lume.lua b/lume.lua index f9a52b4..5813492 100644 --- a/lume.lua +++ b/lume.lua @@ -232,10 +232,10 @@ function lume.reduce(t, fn, first) end -function lume.set(t, retainkeys) +function lume.set(t) local rtn = {} for k, v in pairs(lume.invert(t)) do - rtn[retainkeys and v or (#rtn + 1)] = k + rtn[#rtn + 1] = k end return rtn end