Function Pointers

BlitzMax Forums/BlitzMax Beginners Area/Function Pointers

PoliteProgrammer(Posted 2012) [#1]
Hi all, I've been trying to figure out function pointers. I found this example posted about 7 months ago, but it doesn't work for me. Specifically, I get the following error:
"Expression of type 'Byte Ptr' cannot be invoked"
for the line l[0].

Would anyone mind explaining what I'm doing wrong?

SuperStrict
Local l:Byte Ptr[5]
l[0]=test1
l[1]=test2
l[0]
Function test1()
	Print"1"
EndFunction
Function test2()
	Print"2"
EndFunction



jsp(Posted 2012) [#2]
An int array could do the job as well

SuperStrict
Local l:Int()[]
l[0]=test1
l[1]=test2
l[0]()
Function test1()
	Print"1"
EndFunction
Function test2()
	Print"2"
EndFunction



PoliteProgrammer(Posted 2012) [#3]
Ah, that makes it very clear. Thanks a lot!