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 / multi dimensional array problem

Author
Message
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 4th Jun 2018 10:28 Edited at: 4th Jun 2018 10:35
array declaration and data assignment


Attempting to search array with 'x = VData.lref[i]'
I get a compiler error telling me the array isn't defined.
If I delete that line, it compiles just fine. I've also tried x = VData[i].lref which also tells me the array is undefined. The entire function is as follows.


main.agc:226: error: "vdata" has not been defined as a type
I've got no clue what this means.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 4th Jun 2018 10:34 Edited at: 4th Jun 2018 10:36
Quote: "Attempting to search array with 'x = VData.lref[i]'"


This should be x = VData[i].lref

VData is your array.....lref is a single integer inside the type

Also you will need to make VData a Global variable to use it in functions

And your searches probably fail due to non-sorted arrays as per your other thread
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 4th Jun 2018 10:37
ok, adjusted the code to x = VData[i].lref

main.agc:226: error: "vdata" has not been defined as an array
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 4th Jun 2018 10:45
Quoting myself...

Also you will need to make VData a Global variable to use it in functions

Or pass the array to the function as one of the arguments
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 4th Jun 2018 11:40
yes, I wasn't aware I had to define the array as a global, since the documentation stated that all arrays are automagically global and accessible from anywhere in your code. But now that it is global, it compiles and I can search it all I want. I was trying to reply sooner but my internet connection on my other computer is sketchy at best. Thank you for helping me find the issues and get back on track.

Login to post a reply

Server time is: 2024-11-23 20:43:16
Your offset time is: 2024-11-23 20:43:16