Function Handles Example please?
BlitzMax Forums/BlitzMax Programming/Function Handles Example please?
| ||
Could anyone write a function handle example please? I knew blitz could do that but I can't remember the syntax and can't find anything. Thank you |
| ||
You mean callbacks? Like: Global myCallback:Int( value:Int ) Function setCallback( c:Int(v:Int) ) myCallback = c EndFunction Function test:Int( v:Int ) If myCallback Return myCallback(v) Else Return 0 EndIf EndFunction ' ' The function we'll use as a callback ' Function bla:Int( in:Int ) Return in*2 EndFunction ' ' Testing... ' Print "Before callback has been set" Print test( 1000 ) ' ' Setting the callback setCallback( bla ) Print "After callback has been set" Print test( 1000 ) |
| ||
Yeap thx that's exactly what I wanted. |