Advertisement
Guest User

Untitled

a guest
Mar 5th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function table_count(tt, item)
  2. local count
  3. count = 0
  4. for ii,xx in pairs(tt) do
  5. if item == xx then count = count + 1 end
  6. end
  7. return count
  8. end
  9.  
  10. function table_unique(tt)
  11. local newtable = {}
  12. for ii,xx in ipairs(tt) do
  13. if table_count(newtable, xx) == 0 then
  14. newtable[#newtable+1] = xx
  15. end
  16. end
  17. return newtable
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement