Call function with Identifier as a String?

BlitzMax Forums/BlitzMax Beginners Area/Call function with Identifier as a String?

GamerTheHut(Posted 2006) [#1]
Can a function be called using a string as the name of the function?

e.i.

RunFunction$ = "Function2"

'?
End

Function Function1()
Print "Function 1"
End Function

Function Function2()
Print "Function 2"
End Function


Dreamora(Posted 2006) [#2]
No, thats not supported in compiled languages (for various reasons)

But what you can do is use functionreferences:

global RunFunction()

RunFunction = Function1
RunFunction()

RunFunction = Function2
RunFunction


GamerTheHut(Posted 2006) [#3]
k thanks