I am trying to make a sorting function and I need to remove duplicates from a table/array so I can get the top 3, but when I do so, it changes the original table/array.
function removeDuplicates(list)
input = list
i = 0
while i < #input
do
if input[i] == input[i + 1] then
table.remove(input, i)
else
i = i + 1
end
end
return input
end
Is there some smart, proper way of doing this? Can I iterate over the array and set every value to a new array?