Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

https://pt.stackoverflow.com/q/38705/101

a = {{a=1, b=2}, {a=2, b=3}, {a=1, b=2}, {a=3, b=2}, {a=1, b=2}}
 
for i = #a, 2, -1 do
	for j = i - 1, 1, -1 do
		if (a[j].a == a[i].a and a[j].b == a[i].b) then
			table.remove(a, i)
			break
		end
	end
end
 
-- demonstração do resultado:
for i, j in pairs(a) do
	print(i .. ". a=" .. j.a .. ", b=" .. j.b)
end

--https://pt.stackoverflow.com/q/38705/101

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.