-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check if entity exists before accessing #68
Conversation
Check if entities exist before trying to add components to them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Would you be okay adding similar checks where we use w.entity
or w.entity_mut
. Much appreciated!
Yeah, I'll do a search and see how many other places I can add it in. I'm honestly tempted to try to implement an option or result style construct in lua, perhaps leverage multiple value return, but I think I can experiment with that a bit further down stream for the time being. |
Thanks!
I've considered something like this in the past, although I've stuck with the mlua convention of converting |
I've been lost in some other weeds the past week but I'll see if I can get this done this weekend. |
5fd50e0
to
cc44e91
Compare
I have some more bases covered now. There's some other things that look like potential cases that could be checked, but I wouldn't really want to mess with them without first having a test case that is known to fail, and building those tests cases is not something I'm up for doing at the moment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, if we need any more checks anywhere else we can add later. Thanks!
Looks like I've finally made CI happy. Not sure why it says I dismissed the review above, that must have been something automatic. |
Yeah it's automatic, might disable that as the message looks quite confusing. |
I've run into a few panics with world access if you happen to hold on to entity values between frames. I'm not certain this is the ideal way to handle them, so feel free to suggest changes or go with an alternate implementation if desired.