I have a table full of 12 ghosts which I index to check if they are still there with this function:
for i,v in pairs(GhostTypes) do --Prints through all 12 ghost types properly
warn(v)
end
warn("ghosts: "..#GhostTypes) --Prints 12 which is expected
But when I run my next function for some odd reason it doesn’t index through all 12 ghost types:
for GhostIndex, Ghost in pairs(GhostTypes) do
if Ghost ~= "No Ghost Found" then
local LocalGhostEvidence = GetLocalGhostEvidence(Ghost)
local Match = true
for EvidenceIndex, Evidence in pairs(SelectedEvidences) do
if Evidence ~= "No Evidence Found" then
if LocalGhostEvidence[Evidence] ~= true then
Match = false
RemoveGhostIndex(Ghost)
print(Ghost.." is not available for selection because it is lacking: "..Evidence)
break --This break does not effect the loop as the print above runs multiple times and still works
else
print(Ghost.." is approved further because it has evidence: "..Evidence)
end
end
end
if Match == true then
--print(Ghost.." is still available for selection.")
end
else
warn(Ghost.." is not available to be scanned")
end
warn("finished index spot: "..GhostIndex) --I use this to tell how many times the loop has indexed and it usually finished around 7-9
end
If anyone has any idea on how to fix this a reply would be much appreciated, thanks!