Looks like any function that takes in a function and returns a value will have to wait. It seems support for that sort of block is… only halfway baked. Here are some screenshots of my suffering:
Adding
//% draggableParameters="reporter" results in this classic issue:Then I just ignored those and tried to get it working and it seems that it just forgets that the block is supposed to add the code inside to the javaScript half of the equation entirely and resulted in a error in blocks that didn’t stop the game from running and wasn’t an error once switched to javaScript:
Anyways yeah. Some absolutely cursed looking blocks here. @richard if you have any advice, it is more than welcome! I’ve tried every permutation of having and not having certain parts of this, but here is all of stuff I’ve tried written into one block:
/**
* Returns true if any element of an array makes the code return true.
*/
//% blockID="extras_some_array"
//% block="some $target=variables_get(list) $value=variables_get(value) $index=variables_get(index)"
//% group="Operations"
//% draggableParameters="reporter" // This would be required for the block I want but does not work.
//% handlerStatement // idk I thought it might do something. It didn't.
//% blockNamespace="arrays"
export function some_array_block(target: Array<any>, condition: (value: any, index: number)=>boolean) {
return target.some(condition) // This would be ideal but I have tried the other one and it's not working either it seems.
//target.some(condition)
}






