.temp:8: 'do' expected near 'in'

Started by TheTinyDeskEngineer, Apr 07, 2021, 11:27 PM

Previous topic - Next topic

TheTinyDeskEngineer

The error is coming from this line:
for s = 1, i in ipairs(whitelist) doI've done stuff like this before and it's never given this error. I don't think there's anything else needed, since it's complaining about something which should all be on this line.

Lupus590

You seem to have something that is halfway between the two valid types of for loop.

I believe that what you mean is.
for s, i in ipairs(whitelist) do

redstonegenius

you don't use "s,"

when using the "in" keyword, the variable before it inherits whatever element is in the table

example

```
local arr = {1,2,3,"e"}
for a in arr do
 print(a)
end
```

will output

1
2
3
"e"

because "a" now inherits the whatever element you are currenly working on