function array

Blitz3D Forums/Blitz3D Beginners Area/function array

Onne(Posted 2008) [#1]
Is there a way to make an array of a function() something like:

dim afunction(1)

for t=0 to 1
afunction(t)()
next

function afunction(0)()
;code
end function

function afunction(1)()
;code
end function


I know, that looks very weird.


Dreamora(Posted 2008) [#2]
no there isn't.

Only Blitzmax supports function pointers, Blitz3D / BlitzPlus do not support that.

You would need to integrate scripting or use BriskVM for such a feature.


boomboom(Posted 2008) [#3]
you could do:

For i = 0 to 4
   afunction(i)
Next

Function afunction(i)
   Select i
      Case 0
         ;Code
      Case 1
         ;Code
      Case 2
         ;Code
      ETC...
end function