ophelius 0 Posted September 3, 2011 Hi, Is it possible to store the address of a function so I can call it based on a variable? For example, let's say I have 3 functions, a(), b(), and c(), and the program needs to call one of those based on a variable x. So first i would allocate an array F[3] and store the addresses of all 3 functions like this: F[0] = @a(), F[1] = @b(), F[2] = @c() and now I can simply do this: call F[x]. And if x = 0, the a() would be called, etc. I'm aware that I can do: If x = 0, then call a(), etc, but that's not what I need. Thanks Share this post Link to post Share on other sites
monoscout999 10 Posted September 3, 2011 $a = "try1" Call($a) Func try1() consolewrite("it works!"&@crlf) EndFunc maybe this? I preffer using other methods like adding a parameter into the function, but this works. Share this post Link to post Share on other sites
ophelius 0 Posted September 3, 2011 Great, that works. I wasn't aware you can call a function like that. Thanks Share this post Link to post Share on other sites