Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can I call a function whose name is stored in a variable ??? #215629
07/12/08 14:06
07/12/08 14:06
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi everybody,

I got a question about calling functions.

Is it possible to call a function when I have the function name only stored in a variable?

For example:

action test() {
// do somethins
}

STRING* functionName = "test";

void main() {
// call action with name functionName
}

Regards,
Pegamode.

Re: Can I call a function whose name is stored in a variable ??? [Re: pegamode] #215630
07/12/08 14:20
07/12/08 14:20
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hello,

perhaps this is of any help:
http://www.conitec.net/beta/engine_getscript.htm

Re: Can I call a function whose name is stored in a variable ??? [Re: Fenriswolf] #215632
07/12/08 14:27
07/12/08 14:27
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hey ... that seems to be exactly what I am looking for.

I'll try that and give feedback.

Thanks.

Re: Can I call a function whose name is stored in a variable ??? [Re: pegamode] #215633
07/12/08 14:39
07/12/08 14:39
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi,

when I call:

pFunction = engine_getscript("myFunction");
pFunction();

everything works fine, but when I do something like that:

STRING* funcName = "myFunction";
...
pFunction = engine_getscript(funcName);
pFunction();

the engine crashes :-(

Any ideas ???

Regards,
Pegamode.

Re: Can I call a function whose name is stored in a variable ??? [Re: pegamode] #215634
07/12/08 14:44
07/12/08 14:44
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ahhhhhhhhhh ...

I have to put the function name in a char and not in a string.

Now everything works fine.

Thanks for your help.

Regards,
Pegamode.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1