title: Lua : remove duplicate elements
body: <p>i am having a table in lua</p>
  
  <pre>
  test = {1,2,4,2,3,4,2,3,4,"A", "B", "A"}
  </pre>
  
  <p>I want to remove all duplicate elements in table.<br>
  Output should be    </p>
  
  <pre>
  test = {1,2,4,3,"A","B"}
  </pre>
  
  <h2>EDIT:</h2>
  
  <p>My try :</p>
  
  <pre>
  > items = {1,2,4,2,3,4,2,3,4,"A", "B", "A"}
  > flags = {}
  > for i=1,table.getn(items)  do
  if not flags[items[i]] then
        io.write(' ' .. items[i])
        flags[items[i]] = true
     end
  >> end
   1 2 4 3 A B>
  </pre>
  
  <p>It is working fine now.
  Thanks for answers and comments.</p>