Hello!
Anyone know an extension or a way to store functions inside an array? This means that I can use a “call” block and a “list get value at” block together to call a function at a given index?
Here's a picture example!
Forgive the low resolution Should’ve probably zoomed in more before taking the screenshots ahaha
2 Likes
Luke
June 17, 2024, 11:21pm
2
returnng a value makes the function able to be used as this V
which can be used in an array
2 Likes
@Reznolv there’s no built in way to do this, but you could create an extension to make this work.
typings might be weird though… but if the function doesn’t need to have parameters or return values then I could make an extension for it real quick
can you share an example function?
3 Likes
Yes but that would store the return value of the function, not the function itself!
2 Likes
For the purpose of my game, the functions have different number and types of arguments
I appreciate the offer! I’ll work on it myself though since it seems to be a good excuse to make an extension and learn typescript
1 Like
@Reznolv check out https://makecode.com/defining-blocks and feel free to @ me if you have any questions!
3 Likes
Sarge
June 18, 2024, 4:24pm
7
Hmm, I could try and pull this off
4 Likes