How would I create a ignore list for a For loop? let’s say I’m trying to get a list of things in a table how would I ignore a string in that table and print out the rest?
local Table = {"Apple","Orange","Tree","Paper","Mouse"} --Ignore Apple and paper
for i,v in pairs(Table) do
print(v) -- Print out the rest
end
Simple. Just make an ignore list, iterate through the main list, and check if value matches a part of the ignore list.
local Table = {"Apple","Orange","Tree","Paper","Mouse"}
local Ignore = {"Apple","Paper"}
for i, v in pairs(Table) do
if table.find(Ignore, v) then
print(v .. " is a part of the Ignore list")
end
end