Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 1,170 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Creating parameters for a function #73177
05/04/06 17:43
05/04/06 17:43
Joined: Dec 2003
Posts: 179
Chameleon_Man Offline OP
Member
Chameleon_Man  Offline OP
Member

Joined: Dec 2003
Posts: 179
Hey guys,

Whats the syntax for creating a function where you pass in the parameter? I'm used to C++, so when I declare function, I do it like this...

function MY_STUFF(var MY_VAR) { //blah }

or

function MY_STUFF(var& MY_VAR) { //blah }

...for passing by reference. Unfortunately I get a compile error. I must be doing something wrong! Help! Thanks a ton.

-Harb

Re: Creating parameters for a function [Re: Chameleon_Man] #73178
05/04/06 21:07
05/04/06 21:07
Joined: May 2005
Posts: 338
Brasil
Filipe Offline
Senior Member
Filipe  Offline
Senior Member

Joined: May 2005
Posts: 338
Brasil
in c-script you don't need the type of the parameter:

function MY_STUFF(/*var*/ MY_VAR) { //blah }

Re: Creating parameters for a function [Re: Filipe] #73179
05/04/06 21:12
05/04/06 21:12
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
you do it like this:

function testfunc(_variable)
{
temp = _variable;
}

or for arrays:

function testfunc2(&array)
{
temp.x=array[0];
temp.y=array[1];
temp.z=array[2];
}

note that i used _variable above instead of just "variable", just in case to make sure this isnt used by any normal variable, you can write "blah" aswell, but adding a _ before is recommended.


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku

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