Function name in variable
BlitzMax Forums/BlitzMax Beginners Area/Function name in variable
| ||
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 |
| ||
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 |
| ||
Being answered in your other thread. |
| ||
You could also use a Hashtable or the TMap like this very generic example: |