Besiege

Besiege

Logic extensions mod
Zane49er 5 Aug, 2021 @ 9:22pm
Bug? or bad code?
I am trying to run some code, and it fails inside a try/catch but still crashes the CPU block.
Is there something try/catch doesn't work on, or is this a mod error?
I know java but have never worked with javascript so sorry if this is a dumb question.


function start() {
try{
if(readSensor(3)){
print("a");
let {velocity:a} = readSensor(3);
print("b");
}
}
catch(err){
print("c");
print(err);
}
finally{
setTimeout(0.1, start);
}
}

start();
< >
Showing 1-2 of 2 comments
Lambda  [developer] 13 Aug, 2021 @ 10:32am 
Hello,

This seems to be a bug in Jint interpreter (or maybe this code does not follow some old version of EcmaScript specification that Jint is using, IDK).
You can fix it by declaring "a" variable before let {velocity:a} = readSensor(3) expression.

BTW JavaScript has no any relation to java, the word "java" here is just marketing stuff.
Lambda  [developer] 13 Aug, 2021 @ 10:56am 
I've patched Jint a bit to make this exception catchable. But I'm not sure how to get this code to work, I don't really know internals of Jint interpreter.
< >
Showing 1-2 of 2 comments
Per page: 1530 50