Advertisement
Pinkishu

uniqval

Sep 25th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. function uniqval(t1,t2)
  2.   local ret = {}
  3.   for k,v in pairs(t1) do
  4.     ret[v]=true
  5.   end
  6.   for k,v in pairs(t2) do
  7.     if ret[v] then
  8.       ret[v] = nil
  9.     else
  10.       ret[v]=true
  11.     end
  12.   end
  13.   function corr(t,k)
  14.     local nk = next(t,k)
  15.     if not nk then
  16.       return
  17.     else
  18.       return nk,corr(t,nk)
  19.     end
  20.   end
  21.   return {corr(ret,k)}
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement