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.

DarkBASIC Professional Discussion / Array Index Valid problems

Author
Message
Gamefreak
20
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 28th Nov 2005 21:51
This command isn't exactly what I figure it should be. I dont think that negative numbers are valid indexes since they crash the program...Anyway, if i check if an index is valid, and then check if the value of that index is equal to a number if it is valid, the program shouldn't crash because ARRAY INDEX VALID let slip a negative number as being a valid index.

If this command worked correctly, it would save a lot of work since i'm using multi-dimensional arrays.

Any ideas?
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Nov 2005 22:20
Er? Can we see the relevant code please?
Gamefreak
20
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 28th Nov 2005 23:18
If you want an example, here:



Output:
1
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Nov 2005 23:46
Hmm...? Not at all clear what the function is doing. Nothing special about negative index values - try this:

Gamefreak
20
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 28th Nov 2005 23:54 Edited at: 28th Nov 2005 23:57
[EDITED]
I did a search in bug reports, turns out you dont give an index as an argument. It is for detecting if the pointer is at the end yet or something...oh well.

They do need a command to check if the index is valid though.
Grog Grueslayer
Valued Member
20
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Nov 2005 23:29
Dimensionalizing always makes indexes go from zero to whatever you want for the max. If you always keep the array within the limits you don't even have to check if it's valid to use it.

Login to post a reply

Server time is: 2025-06-12 11:09:52
Your offset time is: 2025-06-12 11:09:52