How to create a embedded callback function parameter!


This should work for pretty much any use-case, passing along a function name inside the parameter will make the function call the function, if you get what I mean.

Parameter

callback:() -> (a...)

Example

function example(param1, param2, callback:() -> (a...)): () | any
end

You can name the callback argument whatever you’d like, such as returnFunction or functionToCallWhenDone, however it must contain the type argument.

3 Likes