Get Function Pointer as an Int?

BlitzMax Forums/BlitzMax Beginners Area/Get Function Pointer as an Int?

Local myfunctionptr()

Function hello()
   Print "Hello"
End Function

Function hello2()
   Print "Hello 2"
End Function

myfunctionptr=hello
myfunctionptr() ' Prints Hello
myfunctionptr=hello2
myfunctionptr()  ' Prints Hello 2

In other words you can decide what function is called at runtime instead of at compile-time. You could have one single generic framework of a routine, which calls one function by way of a function pointer, then before you enter the routine or elsewhere you could `rewire` which function is called by just making your function call point to some other function. Saves you having to re-write the code for lots of different specific situations. Cuts down on code repetition. Also used constructively can make your software much more flexible at runtime than it could otherwise be.