Gamestudio Links
Zorro Links
Newest Posts
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
New Zorro version 3.15
by jcl. 11/09/26 09:24
Removing outliers from files
by jcl. 11/04/26 10:30
[MED] Import from FBX (2010) missing!!!
by rayp. 11/03/26 14:33
What are you working on?
by rayp. 11/02/26 13:57
No connection to MT4
by JeyKey II. 10/29/26 09:34
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (LoT, 1 invisible), 6,605 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
dabolong, MaliceTheMaker, Haitao_Ren, JimSimons, julienp
19249 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,440
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,440
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 | 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