this code
a = {}
for i = 1 , 25 do
table.insert(a, i)
end
print(#a)
for i = 1 , #a, 1 do
print("now a[i] = " .. tostring(a[i]))
if a[i] == 3 then
print("Number remove = " .. a[i])
table.remove(a, i)
i = i - 1
elseif a[i] == 4 then
print("Number remove = " .. a[i])
table.remove(a, i)
i=i-1
end
end
and here output
25
now a[i] = 1
now a[i] = 2
now a[i] = 3
Number remove = 3
now a[i] = 5
now a[i] = 6
now a[i] = 7
now a[i] = 8
now a[i] = 9
now a[i] = 10
now a[i] = 11
now a[i] = 12
now a[i] = 13
now a[i] = 14
now a[i] = 15
now a[i] = 16
now a[i] = 17
now a[i] = 18
now a[i] = 19
now a[i] = 20
now a[i] = 21
now a[i] = 22
now a[i] = 23
now a[i] = 24
now a[i] = 25
now a[i] = nil
why it never remove the a[i] == 4 for me and it’s also skipping the output of array after cut in the front , i already do the
i = i - 1