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 / [Tier 1] Passing an array as a paramater/argument in a function

Author
Message
KUICS
11
Years of Service
User Offline
Joined: 1st Aug 2012
Location: Australia
Posted: 1st Oct 2012 18:11
Hey guys!
Is it possible to pass an array (or a pointer to the array) as an argument in a function? I've checked the AppGameKit manual under "function" and "array" but neither seem to answer whether this can be done.

I've tried numerous ways of passing it in but nothing has worked so far (doesn't compile)

If this is not possible then I believe this is a very annoying oversight -- how would one deal with this?

Thanks in advance

www.kuics.com - KUICS Australia PTY LTD
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 1st Oct 2012 20:45
In Tier 1, I do not believe you can pass an array. There is no way for the function to know the size of the array. Tier 1 has enough trouble with arrays already.

And there is no such thing as a pointer in Tier 1.

You can pass in UDTs (User Defined Type), but not arrays of them.

In Tier 1 the solution is to make the array global (and supposedly the dim command does that automagically, but I always use 'global dim <whatever>' just to be sure) and pass the index to use as a function parameter/argument.

Cheers,
Ancient Lady
AGK Community Tester
KUICS
11
Years of Service
User Offline
Joined: 1st Aug 2012
Location: Australia
Posted: 2nd Oct 2012 07:03
Ah that's a bit of a nuisance. No worries though, I can live with that.

Cheers for the speedy reply ^_^

www.kuics.com - KUICS Australia PTY LTD

Login to post a reply

Server time is: 2024-05-04 12:49:14
Your offset time is: 2024-05-04 12:49:14