All of my isolated tests pass. I too use a priority-based hooklist in Blockman and it uses Array.sort and it doesn't seem to fail. Time to use your Threads.js in a small demo project and see if it works or not. I also wonder if the rendering is due to my sprite-batched graphics backend... Could you be fooling it? That said, the array.sort method should never nullify anything.
Ok a small test, you'll need at least a test-map:
RequireScript("Threads.js");
function Test() {
Threads.initialize();
Threads.createEntityThread(new Textbox("Hi, how are you?"));
MapEngine("testmap.rmp", 60);
}
function Textbox(text) {
this.wind = GetSystemWindowStyle();
this.font = GetSystemFont();
this.text = text;
}
Textbox.prototype.render = function() {
this.wind.drawWindow(16, 16, GetScreenWidth(), 64);
this.text.drawTextBox(16, 16, GetScreenWidth(), 64, 0, this.text);
}
Textbox.prototype.update = function() {
if (IsAnyKeyPressed()) return false;
else return true;
}
I don't think it's Array.sort() that's doing it, I mean it's really messed up. I get a green wash over everything, which is otherwise not possible with this code. And it doesn't draw the text.
Edit:
However if I change the update method to this, it seems to draw everything correctly but the text:
Textbox.prototype.update = function() {
if (IsKeyPressed(KEY_ENTER)) return false;
else return true;
}