Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Passing Arrays in Tier 1?

Author
Message
Shadow Fan 0
16
Years of Service
User Offline
Joined: 27th Jan 2008
Location: Livermore, CA
Posted: 7th Jun 2012 01:33
Hi All,

Two questions, of which a yes to the first could invalidate the second.

1) Are arrays global by default? I.e. is the following code redundant?



2) If not, what's the syntax for passing an array as a function parameter should the need arise? Apparently the compiler complains when I tried the following logical guess at it:



"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jun 2012 03:04
1) Theoretically all dimmed things are global. But I always use 'global' if I intend it to be global, for clarity. And just in case they change the rules on that later.

2) Passing arrays as function parameters is not allowed. Sorry.

Cheers,
Ancient Lady
Shadow Fan 0
16
Years of Service
User Offline
Joined: 27th Jan 2008
Location: Livermore, CA
Posted: 7th Jun 2012 03:25
Many thanks for the prompt reply, I appreciate it.

Another related question that came to mind: I'm assuming passing by reference is also not allowed? I might be thinking too much in C++

"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jun 2012 04:14
I know you can pass in a UDT variable as well as other types.

I don't know if you can change the value of a passed in variable and have it stick after the function is called.

I'm pretty certain not.

So passing by reference is probably a no.

Cheers,
Ancient Lady
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Jun 2012 10:51
Just tested it using this code and no, the UDT variable is not passed as a reference. Sorry!


Login to post a reply

Server time is: 2024-11-23 15:37:39
Your offset time is: 2024-11-23 15:37:39