Callback code..
Monkey Forums/Monkey Programming/Callback code..
| ||
is something like this possible in monkey. [monkeycode] method SomeThing(x,y,result()) do something. 'at the end have the callback function called ( result() ) end method function result() do something with the results of which ever method called me. end function [/monkeycode] |
| ||
[monkeycode] 'this is like a standard callback "signature" Interface Callable Method Action() End 'this is the implementation of a callback Class Result Implements Callable Method Action() Do Whatever here End End ..... 'This is an usage example: Method SomeThing(x,y, whatever:Callable) Do Stuff... whatever.Action() End [/monkeycode] You can have a global instance of each implementation, as we can't have instanceless methods on interfaces. |
| ||
oh that helps a lot thanks mate. |