As the subject says......
entity.remove() does not throw an error for an inValid entity.
I kind of think it probably should.....
entity.remove() does not throw an error for inValid entity.
Moderators: winston, another_commander, Getafix
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
entity.remove() does not throw an error for inValid entity.
Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Re: entity.remove() does not throw an error for inValid enti
The sort of error that stops the rest of the script or the sort of error that sends a message to Latest.log but continues running?
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
Re: entity.remove() does not throw an error for inValid enti
The sort that logs a warning in latest.log but lets the script carry on.
I can see some scratching chins as to why a notification that something you are trying to invalidate is already in that state is necessary, but if the function could do one of several things to said entity depending on circumstances it might be handy to remind scripters (i.e. me) to include appropriate validation.
I can see some scratching chins as to why a notification that something you are trying to invalidate is already in that state is necessary, but if the function could do one of several things to said entity depending on circumstances it might be handy to remind scripters (i.e. me) to include appropriate validation.
Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Re: entity.remove() does not throw an error for inValid enti
A warning in latest.log is more than I get for the sort of problems I have.
(These are mostly self-inflicted due to a typo or logic error on my part, so I won't trouble you with them.)
Still anyone who is writing an OXP script should be checking latest.log both for errors and warnings. If not, the community may well correct them.
Timing of a removal can be tricky if something else kills it at that same moment. Would something like an if(entity != null) check before removing it help in your case?
(These are mostly self-inflicted due to a typo or logic error on my part, so I won't trouble you with them.)
Still anyone who is writing an OXP script should be checking latest.log both for errors and warnings. If not, the community may well correct them.
Timing of a removal can be tricky if something else kills it at that same moment. Would something like an if(entity != null) check before removing it help in your case?
Re: entity.remove() does not throw an error for inValid enti
To be honest, I think the best behaviour here would be it returning false if the entity to remove couldn't be removed because it was being removed already.
IIRC, that's consistent with a number of other functions...
IIRC, that's consistent with a number of other functions...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)