Originally Posted by Resike
However it's intresting, because you would expect that the pairs call would throw a nil error but it doesn't.
|
Because there is no nil error in the call. {nil, nil} doesn't evaluate to nil, it evaluates to an empty table: {}. But since it has no values there is nothing to iterate over and the loop is "skipped".
Code:
> type({nil, nil})
'table'
> for _,_ in pairs(nil) do end
[string "local"]:1: bad argument #1 to 'pairs' (table expected, got nil)
> for _,_ in pairs({}) do end
> -- No output