Exception: TypeError: this.$prepareAmnestyReservist is not a function
Active script: Anarchies 2.4
anarchies.js, line 104:
this.$prepareAmnestyReservist(ship);
Because you haven’t specified the optional thisObject parameter, so this is the global object. (If you were using strict mode, as you should, it would be undefined.)
So the way forEach works has changed with the new JS engine (I don't remember to have used the thisObject parameter before).
Probably that means that I may have to go hunting for other instances of using it in my other OXPs.
Oh, and while we're at it: I wasn't paying full attention during your explanations about the transition to the new JS engine (sorry), so I don't really know what strict mode is all about, and why I should use it, and how I would. Which topic do I find the explanation in?
So the way forEach works has changed with the new JS engine (I don't remember to have used the thisObject parameter before).
You’re misremembering. this is never inherited by inner functions.
Commander McLane wrote:
Oh, and while we're at it: I wasn't paying full attention during your explanations about the transition to the new JS engine (sorry), so I don't really know what strict mode is all about, and why I should use it, and how I would. Which topic do I find the explanation in?
I think I covered it elsewhere, but in the 1.75 announcement I linked to this page and recommended all OXPs use it. The short version is, it helps catch bugs by generating errors for certain types of buggy situation instead of glossing over them, and removes some advanced language features that you almost certainly haven’t seen. Some of those errors were warnings in earlier versions of Oolite, but are now ignored by default if you don’t opt in to strict mode.