-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Passing either {nil} or simply nil will cause the for loop to be skipped and return true instead.
Line 96 in 49b04ac
| function Entity:has(...) |
I discovered this because I had a typo in a component name and was surprised to find that :has was true for nil. I can see the case that passing in no arguments should be true, to match the behavior in :query(...). However I think in the case of has the intuitive behavior should be that it's true IFF all components are present.
Perhaps the answer should be a warning not a change to the return value.
The fixes for this seemed quickly to be somewhat complex to handle cases like {nil, realComponent} so I didn't try to work through them yet. Curious to discuss what "right" is here. Perhaps it is not actually a bug and should just be a documented behavior.