Sign in to follow this  
Followers 0
Jkeith247

Function name in variable

5 posts in this topic

I know there is an easy way to do this... for some reason it is escaping me right now... Basically I am sending UDP commands from one pc to another. The UDP command is in actuallity the name of a function on the other pc. Instead of creating some lengthy "if" statements, I am trying to call the function based on the UDPcommand... Is it possible to call store a function name into a variable and then call the function?

Share this post


Link to post
Share on other sites



main()


Func main()

   Local $functioname = "test"
   Call($functioname)
   If @error Then MsgBox(0,"Reply", "It doesn't work")


EndFunc

Func test()

   MsgBox(0, "Reply", "It Works")

EndFunc

Couldn't you have done it?

Just remember to check if there's an error, your string (received) may be corrupted or invalid.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you very very much.... It was a late night coding marathon and I was not on the mental up and up.... Coffee was not working... We have all been there...

THANK YOU!!!

P.S. Somehow I knew I was going to feel like an idiot....

Edited by Jkeith247

Share this post


Link to post
Share on other sites

Actually no, i can exactly understand your feeling.

Glad to see you find your way.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0