Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

lua remove duplicates from table

local test = {1,2,4,2,3,4,2,3,4,"A", "B", "A"}
local hash = {}
local res = {}

for _,v in ipairs(test) do
   if (not hash[v]) then
       res[#res+1] = v -- you could print here instead of saving to result table if you wanted
       hash[v] = true
   end

end
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #lua #remove #duplicates #table
ADD COMMENT
Topic
Name
2+1 =