lua 添加的时候去重

result = {}

ids = {1,9,6,7}
affs = {3,2,4,5,6}
count =0
for s in *ids
  result[s]=s
for p, v in pairs result
  count = count + 1
print(count.."pppp")
for s in *affs --{1,2,4,5,6,7}
  for k in *result
    if s ~= k and count <4 and result[s]~=s
      result[s]=s
      count = count+1
      break

for p, v in pairs result
print(v)

posted @ 2022-06-24 16:59  改改改  阅读(39)  评论(0编辑  收藏  举报