Callback?

BlitzMax Forums/BlitzMax Beginners Area/Callback?

Does blitzmax support callback functions? I.E., can I store a function in a variable somehow then call it from that variable (an exec() command)?

Thanks,
Sekeol

Yes
Function TEST:string(x:int)
Notify x
EndFunction 

Local MyFunc:string(var:int) 'CALLBACK function
MyFunc = TEST
MyFunc(0) 'diplay message


2nd example
Function RepeatMe(myFunc(x:int))
myFunc(0) 'diplay message
myFunc(1) 'diplay message
myFunc(2) 'diplay message
EndFunction 

Function TEST(x:int)
Notify x
EndFunction 

RepeatMe(TEST)



Thanks. I actually had it close... except I was assigning the function to the variable with the () suffix. Oops.