Pointer Tutorial Request

BlitzMax Forums/BlitzMax Tutorials/Pointer Tutorial Request

A pointer to an object has to be of the type of that object, so if you had a MyType type that you made, you need a MyType Pointer. Not sure exactly if max supports that. There is the generic `Object`, not sure if there is an Object Ptr though. Like Local Instance:MyType=New MyType would give you some kind of handle to the instance but turning it into a pointer you probably get a byte pointer.

Yes you can pass a function pointer as a parameter, it's a variable like any other. e.g.

Function MyFunctionToPass()
Print "Doing it!"
End Function

Function MyFunctionToPassTo(MyFunc())
Print "Here we go..."
MyFunc()
End Function

MyFunctionToPassTo(MyFunctionToPass)

Note it's important not to use () in passing the function to the function, otherwise it will CALL that function and pass the returned value.