tablee = {hi = 3, bean = 2, cake = 1}
tablee2 = {"hi", "bean", "cake"}
toomany = {
hi = 2;
bean = 4;
cake = 5;
}
for i,v in pairs(toomany) do
if v <= tablee[i] then
print(i.." has too many and I don't know how to get rid of it in tablee2")
-- table.remove(tablee2, i) doesn't work because i returns "hi" rather than its position in the table
end
end
The above code needs to get rid of the things in tablee2 when there are too many of them in tablee. This is the method I have to use, because the context I'm using it in forces me to use it like this. I just made this example simpler but similar.
