Function name in variable

BlitzMax Forums/BlitzMax Beginners Area/Function name in variable

gameshastra(Posted 2007) [#1]
I have a function name in a variable as a string

I dont know how to call that function using that variable

Can some one help

thanks in advance


CS_TBL(Posted 2007) [#2]
You could send an event and put the (string-)name of that function in the .extra field. Then you should have the function listen to events (eventhooked), if the function spots 'the name of the function' then you execute it.
This is a way where you never have to do large select-case constructions.

The select-case option is ofcourse also valid but you'll keep updating that code if your function count grows.

Select s$
Case "DoThis"
DoThis ' <- function call
Case "DoThat"
DoThat ' <- function call
EndSelect


tonyg(Posted 2007) [#3]
Being answered in your other thread.


grable(Posted 2007) [#4]
You could also use a Hashtable or the TMap like this very generic example: